feat: добавить reconciler PostgreSQL и S3

This commit is contained in:
2026-11-05 21:21:43 +03:00
parent 0ed4b9cea5
commit a3bbdeef42
12 changed files with 751 additions and 15 deletions
+13 -9
View File
@@ -64,17 +64,21 @@ class MessageRepository:
return None
if attachment_ids:
found = set(
await session.scalars(
select(AttachmentRow.id).where(
AttachmentRow.id.in_(attachment_ids),
AttachmentRow.chat_id == accessible_chat_id,
AttachmentRow.status == 'ready',
found = {
attachment_id: status
for attachment_id, status in (
await session.execute(
select(AttachmentRow.id, AttachmentRow.status).where(
AttachmentRow.id.in_(attachment_ids),
AttachmentRow.chat_id == accessible_chat_id,
)
)
)
)
if found != set(attachment_ids):
).all()
}
if set(found) != set(attachment_ids):
raise NotFound('вложение не найдено')
if any(status != 'ready' for status in found.values()):
raise Conflict('оригинал вложения недоступен')
statement = (
insert(MessageRow)