feat: 后端 API 增加文章分类名称字段
This commit is contained in:
1 parent
40d7d6ab23
commit
04d15c7a5c
2 files changed
+2
-2
No files matched your search
@@ -12,7 +12,7 @@ export const GET: RequestHandler = async ({ platform, url }) => {
|
|||||||
const { results } = await db
|
const { results } = await db
|
||||||
.prepare(
|
.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
|
FROM posts p
|
||||||
LEFT JOIN categories c ON p.category_id = c.id
|
LEFT JOIN categories c ON p.category_id = c.id
|
||||||
ORDER BY p.published_at DESC
|
ORDER BY p.published_at DESC
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export const GET: RequestHandler = async ({ params, platform }) => {
|
|||||||
const post = await db
|
const post = await db
|
||||||
.prepare(
|
.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
|
FROM posts p
|
||||||
LEFT JOIN categories c ON p.category_id = c.id
|
LEFT JOIN categories c ON p.category_id = c.id
|
||||||
WHERE p.slug = ?
|
WHERE p.slug = ?
|
||||||
|
|||||||
Reference in new issue
Block a user