diff --git a/backend/internal/httpapi/handler/attachment.go b/backend/internal/httpapi/handler/attachment.go index ad0f818..e390c6f 100644 --- a/backend/internal/httpapi/handler/attachment.go +++ b/backend/internal/httpapi/handler/attachment.go @@ -52,7 +52,7 @@ func (h *AttachmentHandler) Upload(c *gin.Context) { respondError(c, err) return } - c.JSON(http.StatusCreated, dto.AttachmentFromDomain(att)) + c.JSON(http.StatusAccepted, dto.AttachmentFromDomain(att)) } func (h *AttachmentHandler) Get(c *gin.Context) { diff --git a/backend/internal/storage/postgres/message.go b/backend/internal/storage/postgres/message.go index 67df6cd..604c65d 100644 --- a/backend/internal/storage/postgres/message.go +++ b/backend/internal/storage/postgres/message.go @@ -262,8 +262,8 @@ func (r *MessageRepo) validateAttachments(ctx context.Context, tx pgx.Tx, chatID if !ok || a.chatID != chatID { return &domain.NotFoundError{Entity: "attachment", ID: id} } - if a.status != domain.AttachmentStatusReady { - return &domain.ConflictError{Reason: "вложение " + id + " не готово"} + if a.status == domain.AttachmentStatusFailed { + return &domain.ConflictError{Reason: "вложение " + id + " в состоянии failed"} } } return nil