diff --git a/.cursor/.prompt/1101.md b/.cursor/.prompt/1101.md index f37a43d..f676852 100644 --- a/.cursor/.prompt/1101.md +++ b/.cursor/.prompt/1101.md @@ -1,17 +1,18 @@ -배너 디테일 -카드 디테일 -메인 디테일 프리뷰, 글, 스페셜_랭크 -기본 리스트 , 글이 없습니다. -글쓰기 -글뷰, 댓글 +리스트 +메인 게시판 일반 +메인 게시판 프리뷰 +메인 게시판 스페셜랭크 + +기본 리스트 스페셜_랭크 스페셜_출석 스페셜_제휴업체 스페셜_제휴업체지도 +게시글 뷰 + 댓글 로그인관련 +회원가입 페이지 회원쪽지 -링크로들어오면 보이고 거기서 페이지이동하면안보이게 \ No newline at end of file +링크로들어오면 보이고 거기서 페이지 이동하면 안보이게 \ No newline at end of file diff --git a/prisma/seed.js b/prisma/seed.js index 51e1593..2143f36 100644 --- a/prisma/seed.js +++ b/prisma/seed.js @@ -199,9 +199,10 @@ async function upsertBoards(admin, categoryMap) { ]; const created = []; - // 특수 랭킹 뷰 타입 ID 조회 (사전에 upsertViewTypes로 생성됨) + // 특수 랭킹/텍스트 뷰 타입 ID 조회 (사전에 upsertViewTypes로 생성됨) const mainSpecial = await prisma.boardViewType.findUnique({ where: { key: "main_special_rank" } }); const listSpecial = await prisma.boardViewType.findUnique({ where: { key: "list_special_rank" } }); + const mainText = await prisma.boardViewType.findUnique({ where: { key: "main_text" } }); for (const b of boards) { // 카테고리 매핑 규칙 (트리 기준 상위 카테고리) @@ -233,7 +234,10 @@ async function upsertBoards(admin, categoryMap) { allowAnonymousPost: !!b.allowAnonymousPost, readLevel: b.readLevel || undefined, categoryId: category ? category.id : undefined, - ...(b.slug === "ranking" && mainSpecial ? { mainPageViewTypeId: mainSpecial.id } : {}), + // 메인뷰: 기본이 아니라 텍스트(main_text)로 설정, 랭킹 보드는 특수 랭킹 유지 + ...(b.slug === "ranking" + ? (mainSpecial ? { mainPageViewTypeId: mainSpecial.id } : {}) + : (mainText ? { mainPageViewTypeId: mainText.id } : {})), ...(b.slug === "ranking" && listSpecial ? { listViewTypeId: listSpecial.id } : {}), }, create: { @@ -244,7 +248,10 @@ async function upsertBoards(admin, categoryMap) { allowAnonymousPost: !!b.allowAnonymousPost, readLevel: b.readLevel || undefined, categoryId: category ? category.id : undefined, - ...(b.slug === "ranking" && mainSpecial ? { mainPageViewTypeId: mainSpecial.id } : {}), + // 메인뷰: 기본이 아니라 텍스트(main_text)로 설정, 랭킹 보드는 특수 랭킹 유지 + ...(b.slug === "ranking" + ? (mainSpecial ? { mainPageViewTypeId: mainSpecial.id } : {}) + : (mainText ? { mainPageViewTypeId: mainText.id } : {})), ...(b.slug === "ranking" && listSpecial ? { listViewTypeId: listSpecial.id } : {}), }, }); @@ -382,6 +389,20 @@ async function seedBanners() { await prisma.banner.createMany({ data: items }); } +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"]); + const visibleBoardIds = boards.filter((b) => wantSlugs.has(b.slug)).map((b) => b.id); + const next = { ...current, visibleBoardIds }; + await prisma.setting.upsert({ + where: { key: SETTINGS_KEY }, + update: { value: JSON.stringify(next) }, + create: { key: SETTINGS_KEY, value: JSON.stringify(next) }, + }); +} + async function main() { await upsertRoles(); const admin = await upsertAdmin(); @@ -390,6 +411,7 @@ async function main() { await createRandomUsers(100); await removeNonPrimaryBoards(); const boards = await upsertBoards(admin, categoryMap); + await seedMainpageVisibleBoards(boards); await createPostsForAllBoards(boards, 100, admin); await seedPartnerShops(); await seedBanners(); diff --git a/src/app/page.tsx b/src/app/page.tsx index a7b54e2..45b7b4a 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -18,28 +18,146 @@ export default async function Home({ searchParams }: { searchParams: Promise<{ s const showPartnerShops: boolean = parsed.showPartnerShops ?? true; const visibleBoardIds: string[] = Array.isArray(parsed.visibleBoardIds) ? parsed.visibleBoardIds : []; - // 보드 메타데이터 (이름 표시용) + // 보드 메타데이터 (메인뷰 타입 포함) const boardsMeta = visibleBoardIds.length - ? await prisma.board.findMany({ where: { id: { in: visibleBoardIds } }, select: { id: true, name: true } }) + ? await prisma.board.findMany({ + where: { id: { in: visibleBoardIds } }, + select: { + id: true, + name: true, + slug: true, + category: { select: { id: true, name: true } }, + mainPageViewType: { select: { key: true } }, + }, + }) : []; - const idToMeta = new Map(boardsMeta.map((b) => [b.id, b] as const)); + const idToMeta = new Map( + boardsMeta.map((b) => [ + b.id, + { + id: b.id, + name: b.name, + slug: b.slug, + categoryId: b.category?.id ?? null, + categoryName: b.category?.name ?? "", + mainTypeKey: b.mainPageViewType?.key, + }, + ] as const) + ); const orderedBoards = visibleBoardIds .map((id) => idToMeta.get(id)) - .filter((v): v is { id: string; name: string } => Boolean(v)); + .filter((v): v is any => Boolean(v)); const firstTwo = orderedBoards.slice(0, 2); const restBoards = orderedBoards.slice(2); - const renderBoardPanel = (board: { id: string; name: string }) => ( -