main
This commit is contained in:
@@ -124,7 +124,6 @@ model Board {
|
||||
description String?
|
||||
sortOrder Int @default(0)
|
||||
status BoardStatus @default(active)
|
||||
requiresApproval Boolean @default(false) // 게시물 승인 필요 여부
|
||||
allowAnonymousPost Boolean @default(false) // 익명 글 허용
|
||||
allowSecretComment Boolean @default(false) // 비밀댓글 허용
|
||||
isAdultOnly Boolean @default(false) // 성인 인증 필요 여부
|
||||
|
||||
@@ -200,6 +200,10 @@ async function upsertBoards(admin, categoryMap) {
|
||||
];
|
||||
|
||||
const created = [];
|
||||
// 특수 랭킹 뷰 타입 ID 조회 (사전에 upsertViewTypes로 생성됨)
|
||||
const mainSpecial = await prisma.boardViewType.findUnique({ where: { key: "main_special_rank" } });
|
||||
const listSpecial = await prisma.boardViewType.findUnique({ where: { key: "list_special_rank" } });
|
||||
|
||||
for (const b of boards) {
|
||||
// 카테고리 매핑 규칙 (트리 기준 상위 카테고리)
|
||||
const mapBySlug = {
|
||||
@@ -227,20 +231,22 @@ async function upsertBoards(admin, categoryMap) {
|
||||
update: {
|
||||
description: b.description,
|
||||
sortOrder: b.sortOrder,
|
||||
requiresApproval: !!b.requiresApproval,
|
||||
allowAnonymousPost: !!b.allowAnonymousPost,
|
||||
readLevel: b.readLevel || undefined,
|
||||
categoryId: category ? category.id : undefined,
|
||||
...(b.slug === "ranking" && mainSpecial ? { mainPageViewTypeId: mainSpecial.id } : {}),
|
||||
...(b.slug === "ranking" && listSpecial ? { listViewTypeId: listSpecial.id } : {}),
|
||||
},
|
||||
create: {
|
||||
name: b.name,
|
||||
slug: b.slug,
|
||||
description: b.description,
|
||||
sortOrder: b.sortOrder,
|
||||
requiresApproval: !!b.requiresApproval,
|
||||
allowAnonymousPost: !!b.allowAnonymousPost,
|
||||
readLevel: b.readLevel || undefined,
|
||||
categoryId: category ? category.id : undefined,
|
||||
...(b.slug === "ranking" && mainSpecial ? { mainPageViewTypeId: mainSpecial.id } : {}),
|
||||
...(b.slug === "ranking" && listSpecial ? { listViewTypeId: listSpecial.id } : {}),
|
||||
},
|
||||
});
|
||||
created.push(board);
|
||||
|
||||
Reference in New Issue
Block a user