fix(attachment): check download variant and readiness
This commit is contained in:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user