From 0bf5515629f1cfe1557dba4f8d588ac64b77d408 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Wed, 5 Feb 2025 19:41:34 +0200 Subject: 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 --- internal/data/notifications.sql.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'internal/data/notifications.sql.go') 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 -- cgit v1.3.1