Доработайте публикацию и сверку вложений по итогам ревью

This commit is contained in:
2026-11-18 11:43:27 +03:00
parent 1f06d9f4ab
commit 80c4a56200
27 changed files with 605 additions and 275 deletions
+3 -2
View File
@@ -18,6 +18,7 @@ import (
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgxpool"
"messenger/internal/attachment"
"messenger/internal/chat"
"messenger/internal/platform/apperr"
"messenger/internal/platform/postgres"
@@ -202,7 +203,7 @@ func validateAttachments(ctx context.Context, tx pgx.Tx, chatID uuid.UUID, ids [
if err != nil {
return fmt.Errorf("check attachments: %w", err)
}
statuses, err := pgx.CollectRows(rows, pgx.RowTo[string])
statuses, err := pgx.CollectRows(rows, pgx.RowTo[attachment.FileStatus])
if err != nil {
return fmt.Errorf("read attachment status: %w", err)
}
@@ -210,7 +211,7 @@ func validateAttachments(ctx context.Context, tx pgx.Tx, chatID uuid.UUID, ids [
return apperr.NotFound("attachment not found")
}
for _, status := range statuses {
if status != "ready" {
if status != attachment.FileReady {
return apperr.Conflict("attachment is not ready")
}
}