This commit is contained in:
@@ -180,7 +180,6 @@ async function upsertCategories() {
|
||||
{ name: "메인", slug: "main", sortOrder: 1, status: "active" },
|
||||
{ name: "명예의 전당", slug: "hall-of-fame", sortOrder: 2, status: "active" },
|
||||
{ name: "소통방", slug: "community", sortOrder: 3, status: "active" },
|
||||
{ name: "TEST", slug: "test", sortOrder: 4, status: "active" },
|
||||
];
|
||||
const map = {};
|
||||
for (const c of categories) {
|
||||
@@ -352,15 +351,12 @@ async function upsertBoards(admin, categoryMap) {
|
||||
{ name: "회원랭킹", slug: "ranking", description: "랭킹", sortOrder: 14 },
|
||||
{ name: "무료쿠폰", slug: "free-coupons", description: "쿠폰", sortOrder: 15 },
|
||||
{ name: "월간집계", slug: "monthly-stats", description: "월간 통계", sortOrder: 16 },
|
||||
// TEST
|
||||
{ name: "TEST", slug: "test", description: "테스트 게시판", sortOrder: 20 },
|
||||
// 광고/제휴 계열 게시판은 제거(메인/명예의전당/소통방 외)
|
||||
];
|
||||
|
||||
const created = [];
|
||||
// 텍스트/특수랭킹/특수출석 뷰 타입 ID 조회 (사전에 upsertViewTypes로 생성됨)
|
||||
const mainText = await prisma.boardViewType.findUnique({ where: { key: "main_text" } });
|
||||
const mainPreview = await prisma.boardViewType.findUnique({ where: { key: "main_preview" } });
|
||||
const listText = await prisma.boardViewType.findUnique({ where: { key: "list_text" } });
|
||||
const mainSpecial = await prisma.boardViewType.findUnique({ where: { key: "main_special_rank" } });
|
||||
const listSpecial = await prisma.boardViewType.findUnique({ where: { key: "list_special_rank" } });
|
||||
@@ -384,8 +380,6 @@ async function upsertBoards(admin, categoryMap) {
|
||||
qna: "community",
|
||||
tips: "community",
|
||||
anonymous: "community",
|
||||
// TEST
|
||||
test: "test",
|
||||
// 광고/제휴
|
||||
};
|
||||
const categorySlug = mapBySlug[b.slug] || "community";
|
||||
@@ -404,7 +398,6 @@ async function upsertBoards(admin, categoryMap) {
|
||||
...(b.slug === "ranking" && mainSpecial ? { mainPageViewTypeId: mainSpecial.id } : {}),
|
||||
...(b.slug === "ranking" && listSpecial ? { listViewTypeId: listSpecial.id } : {}),
|
||||
...(b.slug === "attendance" && listSpecialAttendance ? { listViewTypeId: listSpecialAttendance.id } : {}),
|
||||
...(b.slug === "test" && mainPreview ? { mainPageViewTypeId: mainPreview.id } : {}),
|
||||
},
|
||||
create: {
|
||||
name: b.name,
|
||||
@@ -420,7 +413,6 @@ async function upsertBoards(admin, categoryMap) {
|
||||
...(b.slug === "ranking" && mainSpecial ? { mainPageViewTypeId: mainSpecial.id } : {}),
|
||||
...(b.slug === "ranking" && listSpecial ? { listViewTypeId: listSpecial.id } : {}),
|
||||
...(b.slug === "attendance" && listSpecialAttendance ? { listViewTypeId: listSpecialAttendance.id } : {}),
|
||||
...(b.slug === "test" && mainPreview ? { mainPageViewTypeId: mainPreview.id } : {}),
|
||||
},
|
||||
});
|
||||
created.push(board);
|
||||
@@ -567,7 +559,7 @@ async function seedMainpageVisibleBoards(boards) {
|
||||
const SETTINGS_KEY = "mainpage_settings";
|
||||
const setting = await prisma.setting.findUnique({ where: { key: SETTINGS_KEY } });
|
||||
const current = setting ? JSON.parse(setting.value) : {};
|
||||
const wantSlugs = new Set(["notice", "free", "ranking", "test"]);
|
||||
const wantSlugs = new Set(["notice", "free", "ranking"]);
|
||||
const visibleBoardIds = boards.filter((b) => wantSlugs.has(b.slug)).map((b) => b.id);
|
||||
const next = { ...current, visibleBoardIds };
|
||||
await prisma.setting.upsert({
|
||||
|
||||
Reference in New Issue
Block a user