From 04d15c7a5ce17b9d76cf1028d421530203928a10 Mon Sep 17 00:00:00 2001 From: seaHi Date: Tue, 22 Sep 2026 21:00:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=8E=E7=AB=AF=20API=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=96=87=E7=AB=A0=E5=88=86=E7=B1=BB=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/api/v1/posts/+server.ts | 2 +- src/routes/api/v1/posts/[slug]/+server.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/api/v1/posts/+server.ts b/src/routes/api/v1/posts/+server.ts index a14fca6..8c694a2 100644 --- a/src/routes/api/v1/posts/+server.ts +++ b/src/routes/api/v1/posts/+server.ts @@ -12,7 +12,7 @@ export const GET: RequestHandler = async ({ platform, url }) => { const { results } = await db .prepare( ` - SELECT p.id, p.slug, p.title, p.published_at, p.updated_at, c.slug as category_slug + SELECT p.id, p.slug, p.title, p.published_at, p.updated_at, c.slug as category_slug, c.name as category_name FROM posts p LEFT JOIN categories c ON p.category_id = c.id ORDER BY p.published_at DESC diff --git a/src/routes/api/v1/posts/[slug]/+server.ts b/src/routes/api/v1/posts/[slug]/+server.ts index e72ca5d..4c798d1 100644 --- a/src/routes/api/v1/posts/[slug]/+server.ts +++ b/src/routes/api/v1/posts/[slug]/+server.ts @@ -11,7 +11,7 @@ export const GET: RequestHandler = async ({ params, platform }) => { const post = await db .prepare( ` - SELECT p.id, p.slug, p.title, p.content, p.published_at, p.updated_at, c.slug as category_slug + SELECT p.id, p.slug, p.title, p.content, p.published_at, p.updated_at, c.slug as category_slug, c.name as category_name FROM posts p LEFT JOIN categories c ON p.category_id = c.id WHERE p.slug = ?