package request import ( "sorbet/internal/entities" ) type ResourceUpsertRequest struct { ID uint `json:"id" xml:"id" form:"id" path:"id"` CategoryID uint `json:"category_id" xml:"category_id" form:"category_id"` Title string `json:"title" xml:"title" form:"title"` Path string `json:"path" xml:"path" form:"path"` Width int32 `json:"width" xml:"width" form:"width"` Height int32 `json:"height" xml:"height" form:"height"` Duration int32 `json:"duration" xml:"duration" form:"duration"` MimeType string `json:"mime_type" xml:"mime_type" form:"mime_type"` Extension string `json:"extension" xml:"extension" form:"extension"` Size int64 `json:"size" xml:"size" form:"size"` } func (r *ResourceUpsertRequest) GetID() any { return r.ID } func (r *ResourceUpsertRequest) ToMap() map[string]any { return map[string]any{ "id": r.ID, "category_id": r.CategoryID, "title": r.Title, "path": r.Path, "width": r.Width, "height": r.Height, "duration": r.Duration, "mime_type": r.MimeType, "extension": r.Extension, "size": r.Size, } } func (r *ResourceUpsertRequest) ToEntity() any { return &entities.Resource{ ID: r.ID, CategoryID: r.CategoryID, Title: r.Title, Path: r.Path, Width: r.Width, Height: r.Height, Duration: r.Duration, MimeType: r.MimeType, Extension: r.Extension, Size: r.Size, } }