fix
This commit is contained in:
parent
3061bf7837
commit
541cfa45a3
18
database.go
18
database.go
@ -126,17 +126,19 @@ func insertNewConversation() edgedb.UUID {
|
|||||||
|
|
||||||
func insertArea() edgedb.UUID {
|
func insertArea() edgedb.UUID {
|
||||||
// If the Default conversation doesn't exist, create it.
|
// If the Default conversation doesn't exist, create it.
|
||||||
err := edgeClient.QuerySingle(edgeCtx, `
|
var convExists bool
|
||||||
SELECT Conversation
|
edgeClient.QuerySingle(edgeCtx, `
|
||||||
FILTER .name = 'Default' AND .user = global currentUser
|
select exists (
|
||||||
LIMIT 1
|
select Conversation
|
||||||
`, nil)
|
filter .name = 'Default' AND .user = global currentUser
|
||||||
if err != nil {
|
);
|
||||||
|
`, &convExists)
|
||||||
|
if !convExists {
|
||||||
insertNewConversation()
|
insertNewConversation()
|
||||||
}
|
}
|
||||||
// Insert a new area.
|
// Insert a new area.
|
||||||
var inserted struct{ id edgedb.UUID }
|
var inserted struct{ id edgedb.UUID }
|
||||||
err = edgeClient.QuerySingle(edgeCtx, `
|
err := edgeClient.QuerySingle(edgeCtx, `
|
||||||
WITH
|
WITH
|
||||||
positionVar := count((SELECT Area FILTER .conversation.name = 'Default' AND .conversation.user = global currentUser)) + 1
|
positionVar := count((SELECT Area FILTER .conversation.name = 'Default' AND .conversation.user = global currentUser)) + 1
|
||||||
INSERT Area {
|
INSERT Area {
|
||||||
@ -249,5 +251,5 @@ func getCurrentUserKeys() []Key {
|
|||||||
|
|
||||||
func checkIfHaveKey() bool {
|
func checkIfHaveKey() bool {
|
||||||
keys := getCurrentUserKeys()
|
keys := getCurrentUserKeys()
|
||||||
return keys != nil && len(keys) > 0
|
return len(keys) > 0
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user