Compare commits
2 commits
62e0633e69
...
6d14ac365b
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d14ac365b | |||
| 57956f1f6e |
4 changed files with 21 additions and 0 deletions
|
|
@ -647,6 +647,11 @@ components:
|
|||
example:
|
||||
- Attack on Titan
|
||||
- AoT
|
||||
title_desc:
|
||||
description: 'Localized description. Key = language (ISO 639-1), value = description.'
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: string
|
||||
studio:
|
||||
$ref: '#/components/schemas/Studio'
|
||||
tags:
|
||||
|
|
|
|||
|
|
@ -113,6 +113,9 @@ type Title struct {
|
|||
// Tags Array of localized tags
|
||||
Tags Tags `json:"tags"`
|
||||
|
||||
// TitleDesc Localized description. Key = language (ISO 639-1), value = description.
|
||||
TitleDesc *map[string]string `json:"title_desc,omitempty"`
|
||||
|
||||
// TitleNames Localized titles. Key = language (ISO 639-1), value = list of names
|
||||
TitleNames map[string][]string `json:"title_names"`
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,11 @@ properties:
|
|||
- Титаны
|
||||
ja:
|
||||
- 進撃の巨人
|
||||
title_desc:
|
||||
type: object
|
||||
description: Localized description. Key = language (ISO 639-1), value = description.
|
||||
additionalProperties:
|
||||
type: string
|
||||
studio:
|
||||
$ref: ./Studio.yaml
|
||||
tags:
|
||||
|
|
|
|||
|
|
@ -73,6 +73,14 @@ func (s Server) mapTitle(title sqlc.GetTitleByIDRow) (oapi.Title, error) {
|
|||
}
|
||||
oapi_title.TitleNames = title_names
|
||||
|
||||
if len(title.TitleDesc) > 0 {
|
||||
title_descs := make(map[string]string, 0)
|
||||
err = json.Unmarshal(title.TitleDesc, &title_descs)
|
||||
if err != nil {
|
||||
return oapi.Title{}, fmt.Errorf("unmarshal TitleDesc: %v", err)
|
||||
}
|
||||
oapi_title.TitleDesc = &title_descs
|
||||
}
|
||||
if len(title.EpisodesLen) > 0 {
|
||||
episodes_lens := make(map[string]float64, 0)
|
||||
err = json.Unmarshal(title.EpisodesLen, &episodes_lens)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue