feat(worker): process attachments with thumbnails and bounded retries

This commit is contained in:
kk10
2026-11-15 16:50:27 +03:00
parent 8b0ab5440d
commit 19152e7d18
15 changed files with 994 additions and 50 deletions
+27 -1
View File
@@ -11,15 +11,39 @@ type ContentType string
const (
ContentTypePNG ContentType = "image/png"
ContentTypeJPEG ContentType = "image/jpeg"
ContentTypeWebP ContentType = "image/webp"
)
type AttachmentStatus string
const (
AttachmentStatusReady AttachmentStatus = "ready"
AttachmentStatusQueued AttachmentStatus = "queued"
AttachmentStatusProcessing AttachmentStatus = "processing"
AttachmentStatusReady AttachmentStatus = "ready"
AttachmentStatusFailed AttachmentStatus = "failed"
)
const AttachmentContentOriginal = "original"
type AttachmentVariantName string
const (
AttachmentVariantNameThumbnail AttachmentVariantName = "thumbnail"
AttachmentVariantNameCrop AttachmentVariantName = "crop"
AttachmentVariantNameOptimized AttachmentVariantName = "optimized"
)
type AttachmentVariant struct {
Name AttachmentVariantName
ContentType ContentType
SizeBytes int
Width int
Height int
Sha256 string
}
type Attachment struct {
Variants []AttachmentVariant
ID uuid.UUID
ChatID uuid.UUID
OwnerID uuid.UUID
@@ -28,6 +52,8 @@ type Attachment struct {
SizeBytes int
Sha256 string
Status AttachmentStatus
Width *int32
Height *int32
ErrorCode *string
CreatedAt time.Time
UpdatedAt time.Time