main
This commit is contained in:
@@ -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