7.3 태그/카테고리 모델 및 UI o
This commit is contained in:
@@ -100,6 +100,7 @@ export async function GET(req: Request) {
|
||||
isPinned: true,
|
||||
status: true,
|
||||
stat: { select: { recommendCount: true, views: true, commentsCount: true } },
|
||||
postTags: { select: { tag: { select: { name: true, slug: true } } } },
|
||||
},
|
||||
}),
|
||||
]);
|
||||
|
||||
13
src/app/api/tags/route.ts
Normal file
13
src/app/api/tags/route.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
export async function GET() {
|
||||
const tags = await prisma.tag.findMany({
|
||||
orderBy: { name: "asc" },
|
||||
take: 100,
|
||||
select: { slug: true, name: true },
|
||||
});
|
||||
return NextResponse.json({ tags });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user