summaryrefslogtreecommitdiff
path: root/internal/data
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2025-02-05 19:41:34 +0200
committerKyren223 <Kyren223@proton.me>2025-02-05 19:41:34 +0200
commit0bf5515629f1cfe1557dba4f8d588ac64b77d408 (patch)
tree2bfc56b990c6edd6bab6ddf7b10964b0efb1dbcb /internal/data
parent8a8c4e9abc1006da92969e0234bb2d42f587c149 (diff)
When a user sends a message "signal" and the receiving user doesn't have
the signal already open, it will be added as the first signal
Diffstat (limited to 'internal/data')
-rw-r--r--internal/data/notifications.sql.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/data/notifications.sql.go b/internal/data/notifications.sql.go
index 5819438..393d90a 100644
--- a/internal/data/notifications.sql.go
+++ b/internal/data/notifications.sql.go
@@ -11,6 +11,23 @@ import (
"github.com/kyren223/eko/pkg/snowflake"
)
+const insertLastReadMessage = `-- name: InsertLastReadMessage :exec
+INSERT OR IGNORE INTO last_read_messages (
+ user_id, source_id, last_read
+) VALUES (?, ?, ?)
+`
+
+type InsertLastReadMessageParams struct {
+ UserID snowflake.ID
+ SourceID snowflake.ID
+ LastRead int64
+}
+
+func (q *Queries) InsertLastReadMessage(ctx context.Context, arg InsertLastReadMessageParams) error {
+ _, err := q.db.ExecContext(ctx, insertLastReadMessage, arg.UserID, arg.SourceID, arg.LastRead)
+ return err
+}
+
const setLastReadMessage = `-- name: SetLastReadMessage :exec
INSERT INTO last_read_messages (
user_id, source_id, last_read