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

This commit is contained in:
2026-05-26 12:08:39 +08:00
parent 09089e1335
commit b9834d9300
6 changed files with 238 additions and 16 deletions

View File

@@ -85,7 +85,7 @@ func GetPost(w http.ResponseWriter, r *http.Request) {
if dto.Attachments == nil {
dto.Attachments = []AttachmentDTO{}
}
tags, _ := loadPostTagNames(r.Context(), pool, id)
tags, _ := loadPostTagNames(r.Context(), pool, id, requestLangCode(r))
dto.Tags = tags
writeJSON(w, dto)
}
@@ -143,8 +143,10 @@ func listPostsQuery(w http.ResponseWriter, r *http.Request, searchMode bool) {
p.text_zh ILIKE $%d OR p.text_en ILIKE $%d OR p.text_ja ILIKE $%d OR p.text_ko ILIKE $%d OR
p.text_vi ILIKE $%d OR p.text_id ILIKE $%d OR p.text_ms ILIKE $%d OR
EXISTS (SELECT 1 FROM post_attachments pa WHERE pa.post_id = p.id AND pa.filename ILIKE $%d) OR
EXISTS (SELECT 1 FROM post_tags pt JOIN tags t ON t.id = pt.tag_id WHERE pt.post_id = p.id AND t.name ILIKE $%d))`,
n, n, n, n, n, n, n, n, n)
EXISTS (SELECT 1 FROM post_tags pt JOIN tags t ON t.id = pt.tag_id WHERE pt.post_id = p.id AND (
t.name ILIKE $%d OR t.name_en ILIKE $%d OR t.name_ja ILIKE $%d OR t.name_ko ILIKE $%d OR
t.name_vi ILIKE $%d OR t.name_id ILIKE $%d OR t.name_ms ILIKE $%d)))`,
n, n, n, n, n, n, n, n, n, n, n, n, n, n, n)
}
}
order := ` ORDER BY p.published_at DESC NULLS LAST, p.id DESC`