From 57956f1f6e0b8cd565584317fc14d76f6dc8c5de Mon Sep 17 00:00:00 2001 From: Iron_Felix Date: Fri, 5 Dec 2025 23:36:05 +0300 Subject: [PATCH 1/2] feat: field description is added to Title --- api/_build/openapi.yaml | 5 +++++ api/api.gen.go | 3 +++ api/schemas/Title.yaml | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/api/_build/openapi.yaml b/api/_build/openapi.yaml index 7f483fa..5b6f731 100644 --- a/api/_build/openapi.yaml +++ b/api/_build/openapi.yaml @@ -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: diff --git a/api/api.gen.go b/api/api.gen.go index 4fa16f4..ff37ed9 100644 --- a/api/api.gen.go +++ b/api/api.gen.go @@ -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"` diff --git a/api/schemas/Title.yaml b/api/schemas/Title.yaml index 877ee24..fac4a3f 100644 --- a/api/schemas/Title.yaml +++ b/api/schemas/Title.yaml @@ -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: From 6d14ac365bbbb9d795a81b3c2028ab4fbd2c0eb4 Mon Sep 17 00:00:00 2001 From: Iron_Felix Date: Fri, 5 Dec 2025 23:37:13 +0300 Subject: [PATCH 2/2] feat: title desc handling --- modules/backend/handlers/common.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/backend/handlers/common.go b/modules/backend/handlers/common.go index 58862e1..7f2807f 100644 --- a/modules/backend/handlers/common.go +++ b/modules/backend/handlers/common.go @@ -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)