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 {
|
||||
// If the Default conversation doesn't exist, create it.
|
||||
err := edgeClient.QuerySingle(edgeCtx, `
|
||||
SELECT Conversation
|
||||
FILTER .name = 'Default' AND .user = global currentUser
|
||||
LIMIT 1
|
||||
`, nil)
|
||||
if err != nil {
|
||||
var convExists bool
|
||||
edgeClient.QuerySingle(edgeCtx, `
|
||||
select exists (
|
||||
select Conversation
|
||||
filter .name = 'Default' AND .user = global currentUser
|
||||
);
|
||||
`, &convExists)
|
||||
if !convExists {
|
||||
insertNewConversation()
|
||||
}
|
||||
// Insert a new area.
|
||||
var inserted struct{ id edgedb.UUID }
|
||||
err = edgeClient.QuerySingle(edgeCtx, `
|
||||
err := edgeClient.QuerySingle(edgeCtx, `
|
||||
WITH
|
||||
positionVar := count((SELECT Area FILTER .conversation.name = 'Default' AND .conversation.user = global currentUser)) + 1
|
||||
INSERT Area {
|
||||
@ -249,5 +251,5 @@ func getCurrentUserKeys() []Key {
|
||||
|
||||
func checkIfHaveKey() bool {
|
||||
keys := getCurrentUserKeys()
|
||||
return keys != nil && len(keys) > 0
|
||||
return len(keys) > 0
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user