forked from mtusi2026/mtusi2026lab4
feat: add S3 attachments and reconciliation
This commit is contained in:
@@ -344,11 +344,17 @@ func (s *Store) ListMessages(
|
||||
}
|
||||
|
||||
const query = `
|
||||
SELECT id, chat_id, sender_id, text, created_at
|
||||
FROM messages
|
||||
WHERE chat_id = $1
|
||||
AND ($2::timestamptz IS NULL OR (created_at, id) > ($2, $3::uuid))
|
||||
ORDER BY created_at, id
|
||||
SELECT m.id, m.chat_id, m.sender_id, m.text, m.created_at,
|
||||
ARRAY(
|
||||
SELECT ma.attachment_id::text
|
||||
FROM message_attachments ma
|
||||
WHERE ma.message_id = m.id
|
||||
ORDER BY ma.position
|
||||
)
|
||||
FROM messages m
|
||||
WHERE m.chat_id = $1
|
||||
AND ($2::timestamptz IS NULL OR (m.created_at, m.id) > ($2, $3::uuid))
|
||||
ORDER BY m.created_at, m.id
|
||||
LIMIT $4`
|
||||
|
||||
var afterTime any
|
||||
@@ -372,6 +378,7 @@ func (s *Store) ListMessages(
|
||||
&message.SenderID,
|
||||
&message.Text,
|
||||
&message.CreatedAt,
|
||||
&message.AttachmentIDs,
|
||||
)
|
||||
return message, err
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user