Реализовать наблюдаемость мессенджера для ЛР 6 на четыре

This commit is contained in:
2026-11-18 13:24:20 +03:00
parent 470d9d6f1e
commit c236059a83
184 changed files with 20450 additions and 54 deletions
+16
View File
@@ -0,0 +1,16 @@
-- name: CreateMessagesAttachments :execrows
INSERT INTO messages_attachments (message_id, attachment_id, chat_id, position)
SELECT $1, $2, $3, $4
FROM attachments
WHERE id = $2 AND chat_id = $3;
-- name: GetMessagesAttachments :many
SELECT attachment_id, position
FROM messages_attachments
WHERE message_id = sqlc.arg(message_id)
ORDER BY position ASC;
-- name: LockAttachmentsForMessage :many
SELECT id, status FROM attachments
WHERE chat_id = sqlc.arg(chat_id) AND id = ANY(sqlc.arg(attachment_ids)::uuid[])
ORDER BY id FOR SHARE;