1
All checks were successful
Deploy API / deploy (push) Successful in 52s

This commit is contained in:
2026-05-26 17:58:16 +08:00
parent e18da8c6d3
commit 90184d40c7
5 changed files with 111 additions and 7 deletions

View File

@@ -34,7 +34,7 @@ type PostDTO struct {
Language string `json:"language"` // UI locale from ?lang= (matches text selection)
SourceLanguage string `json:"sourceLanguage,omitempty"` // DB source metadata (admin input language)
Text string `json:"text,omitempty"`
Localizations map[string]postLocalePayload `json:"localizations"`
Localizations map[string]postLocalePayload `json:"localizations,omitempty"`
Attachments []AttachmentDTO `json:"attachments"`
IsRecommended bool `json:"isRecommended"`
PublishedAt string `json:"publishedAt"`
@@ -439,10 +439,10 @@ func scanPostRow(r *http.Request, row pgx.Row) (PostDTO, postTextI18n, error) {
if slug != nil {
dto.CategorySlug = *slug
}
dto.SourceLanguage = sourceLang
dto.Language = requestLangCode(r)
dto.Text = texts.pick(r)
dto.Localizations = texts.toLocalizations()
src := normalizePostSourceLang(sourceLang)
dto.SourceLanguage = src
dto.Language = src
dto.Text = texts.textForLang(src)
if pub != nil {
dto.PublishedAt = pub.UTC().Format(time.RFC3339)
} else if created != nil {