fix(attachment): check download variant and readiness

This commit is contained in:
kk10
2026-11-06 15:44:33 +03:00
parent a11463c680
commit bca081428a
4 changed files with 24 additions and 1 deletions
+8
View File
@@ -14,6 +14,10 @@ type CreateAttachmentRequest struct {
Filename string
}
type GetAttachmentContentRequest struct {
Variant string
}
type VariantResponse struct {
Name string `json:"name"`
ContentType string `json:"content_type"`
@@ -52,6 +56,10 @@ func (r CreateAttachmentRequest) Validate() bool {
return true
}
func (r GetAttachmentContentRequest) Validate() bool {
return r.Variant == "" || r.Variant == "original"
}
func ToAttachmentResponse(a model.Attachment) AttachmentResponse {
variants := make([]VariantResponse, 0)
return AttachmentResponse{