fix(posts): get_post_by_slug 的 SELECT 补上 toc_html 列

row_to_post_full 用 row.get("toc_html") 读取该列,但 get_post_by_slug
的 SQL 漏选了 p.toc_html,导致访问公开文章详情时 panic(invalid column
toc_html)。补上列即可。
This commit is contained in:
xfy 2026-06-16 11:34:12 +08:00
parent c60e4e08d7
commit 863ec5ea52

View File

@ -73,7 +73,7 @@ pub async fn get_post_by_slug(slug: String) -> Result<SinglePostResponse, Server
let row = client let row = client
.query_opt( .query_opt(
"SELECT "SELECT
p.id, p.author_id, p.title, p.slug, p.summary, p.content_md, p.content_html, p.id, p.author_id, p.title, p.slug, p.summary, p.content_md, p.content_html, p.toc_html,
p.status, p.published_at, p.created_at, p.updated_at, p.cover_image, p.status, p.published_at, p.created_at, p.updated_at, p.cover_image,
COALESCE(array_agg(t.name) FILTER (WHERE t.name IS NOT NULL), '{}') as tags, COALESCE(array_agg(t.name) FILTER (WHERE t.name IS NOT NULL), '{}') as tags,
prev.title as prev_title, prev.slug as prev_slug, prev.title as prev_title, prev.slug as prev_slug,