diff --git a/api/api.gen.go b/api/api.gen.go index c3ef4da..b3c51f6 100644 --- a/api/api.gen.go +++ b/api/api.gen.go @@ -31,6 +31,13 @@ const ( Planned TitleStatus = "planned" ) +// Image defines model for Image. +type Image struct { + Id *int64 `json:"id,omitempty"` + ImagePath *string `json:"image_path,omitempty"` + StorageType *string `json:"storage_type,omitempty"` +} + // ReleaseSeason Title release season type ReleaseSeason string @@ -57,7 +64,7 @@ type Title struct { // Id Unique title ID (primary key) Id int64 `json:"id"` - PosterId *int64 `json:"poster_id,omitempty"` + Poster *Image `json:"poster,omitempty"` Rating *float64 `json:"rating,omitempty"` RatingCount *int32 `json:"rating_count,omitempty"` @@ -178,12 +185,12 @@ func (a *Title) UnmarshalJSON(b []byte) error { delete(object, "id") } - if raw, found := object["poster_id"]; found { - err = json.Unmarshal(raw, &a.PosterId) + if raw, found := object["poster"]; found { + err = json.Unmarshal(raw, &a.Poster) if err != nil { - return fmt.Errorf("error reading 'poster_id': %w", err) + return fmt.Errorf("error reading 'poster': %w", err) } - delete(object, "poster_id") + delete(object, "poster") } if raw, found := object["rating"]; found { @@ -295,10 +302,10 @@ func (a Title) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("error marshaling 'id': %w", err) } - if a.PosterId != nil { - object["poster_id"], err = json.Marshal(a.PosterId) + if a.Poster != nil { + object["poster"], err = json.Marshal(a.Poster) if err != nil { - return nil, fmt.Errorf("error marshaling 'poster_id': %w", err) + return nil, fmt.Errorf("error marshaling 'poster': %w", err) } } diff --git a/api/openapi.yaml b/api/openapi.yaml index 0356898..d523f06 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -565,6 +565,17 @@ paths: components: schemas: + Image: + type: object + properties: + id: + type: integer + format: int64 + storage_type: + type: string + image_path: + type: string + TitleStatus: type: string description: Title status @@ -665,9 +676,8 @@ components: $ref: '#/components/schemas/Studio' tags: $ref: '#/components/schemas/Tags' - poster_id: - type: integer - format: int64 + poster: + $ref: '#/components/schemas/Image' title_status: $ref: '#/components/schemas/TitleStatus' rating: