게시판 유형 삭제
This commit is contained in:
@@ -24,10 +24,6 @@ enum BoardStatus {
|
||||
archived
|
||||
}
|
||||
|
||||
enum BoardType {
|
||||
general
|
||||
special
|
||||
}
|
||||
|
||||
enum AccessLevel {
|
||||
public // 비회원도 접근
|
||||
@@ -128,7 +124,6 @@ model Board {
|
||||
description String?
|
||||
sortOrder Int @default(0)
|
||||
status BoardStatus @default(active)
|
||||
type BoardType @default(general) // 일반/특수
|
||||
requiresApproval Boolean @default(false) // 게시물 승인 필요 여부
|
||||
allowAnonymousPost Boolean @default(false) // 익명 글 허용
|
||||
allowSecretComment Boolean @default(false) // 비밀댓글 허용
|
||||
@@ -156,7 +151,6 @@ model Board {
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([status, sortOrder])
|
||||
@@index([type, requiresApproval])
|
||||
@@index([categoryId])
|
||||
@@index([mainPageViewTypeId])
|
||||
@@index([listViewTypeId])
|
||||
|
||||
@@ -182,20 +182,20 @@ async function upsertAdmin() {
|
||||
async function upsertBoards(admin, categoryMap) {
|
||||
const boards = [
|
||||
// 일반
|
||||
{ name: "공지사항", slug: "notice", description: "공지", type: "general", sortOrder: 1, writeLevel: "moderator" },
|
||||
{ name: "가입인사", slug: "greetings", description: "가입인사", type: "general", sortOrder: 2 },
|
||||
{ name: "버그건의", slug: "bug-report", description: "버그/건의", type: "general", sortOrder: 3 },
|
||||
{ name: "이벤트", slug: "event", description: "이벤트", type: "general", sortOrder: 4, requiredTags: { required: ["이벤트"] } },
|
||||
{ name: "자유게시판", slug: "free", description: "자유", type: "general", sortOrder: 5 },
|
||||
{ name: "무엇이든", slug: "qna", description: "무엇이든 물어보세요", type: "general", sortOrder: 6 },
|
||||
{ name: "마사지꿀팁", slug: "tips", description: "팁", type: "general", sortOrder: 7 },
|
||||
{ name: "익명게시판", slug: "anonymous", description: "익명", type: "general", sortOrder: 8, allowAnonymousPost: true, allowSecretComment: true },
|
||||
{ name: "청와대", slug: "blue-house", description: "레벨 제한", type: "general", sortOrder: 10, readLevel: "member" },
|
||||
{ name: "공지사항", slug: "notice", description: "공지", sortOrder: 1, writeLevel: "moderator" },
|
||||
{ name: "가입인사", slug: "greetings", description: "가입인사", sortOrder: 2 },
|
||||
{ name: "버그건의", slug: "bug-report", description: "버그/건의", sortOrder: 3 },
|
||||
{ name: "이벤트", slug: "event", description: "이벤트", sortOrder: 4, requiredTags: { required: ["이벤트"] } },
|
||||
{ name: "자유게시판", slug: "free", description: "자유", sortOrder: 5 },
|
||||
{ name: "무엇이든", slug: "qna", description: "무엇이든 물어보세요", sortOrder: 6 },
|
||||
{ name: "마사지꿀팁", slug: "tips", description: "팁", sortOrder: 7 },
|
||||
{ name: "익명게시판", slug: "anonymous", description: "익명", sortOrder: 8, allowAnonymousPost: true, allowSecretComment: true },
|
||||
{ name: "청와대", slug: "blue-house", description: "레벨 제한", sortOrder: 10, readLevel: "member" },
|
||||
// 특수
|
||||
{ name: "출석부", slug: "attendance", description: "데일리 체크인", type: "special", sortOrder: 12 },
|
||||
{ name: "회원랭킹", slug: "ranking", description: "랭킹", type: "special", sortOrder: 14 },
|
||||
{ name: "무료쿠폰", slug: "free-coupons", description: "쿠폰", type: "special", sortOrder: 15 },
|
||||
{ name: "월간집계", slug: "monthly-stats", description: "월간 통계", type: "special", sortOrder: 16 },
|
||||
{ name: "출석부", slug: "attendance", description: "데일리 체크인", sortOrder: 12 },
|
||||
{ name: "회원랭킹", slug: "ranking", description: "랭킹", sortOrder: 14 },
|
||||
{ name: "무료쿠폰", slug: "free-coupons", description: "쿠폰", sortOrder: 15 },
|
||||
{ name: "월간집계", slug: "monthly-stats", description: "월간 통계", sortOrder: 16 },
|
||||
// 광고/제휴 계열 게시판은 제거(메인/명예의전당/소통방 외)
|
||||
];
|
||||
|
||||
@@ -227,7 +227,6 @@ async function upsertBoards(admin, categoryMap) {
|
||||
update: {
|
||||
description: b.description,
|
||||
sortOrder: b.sortOrder,
|
||||
type: b.type,
|
||||
requiresApproval: !!b.requiresApproval,
|
||||
allowAnonymousPost: !!b.allowAnonymousPost,
|
||||
readLevel: b.readLevel || undefined,
|
||||
@@ -238,7 +237,6 @@ async function upsertBoards(admin, categoryMap) {
|
||||
slug: b.slug,
|
||||
description: b.description,
|
||||
sortOrder: b.sortOrder,
|
||||
type: b.type,
|
||||
requiresApproval: !!b.requiresApproval,
|
||||
allowAnonymousPost: !!b.allowAnonymousPost,
|
||||
readLevel: b.readLevel || undefined,
|
||||
|
||||
@@ -369,7 +369,6 @@ export default function AdminBoardsPage() {
|
||||
<th className="px-3 py-2">익명</th>
|
||||
<th className="px-3 py-2">비밀댓</th>
|
||||
<th className="px-3 py-2">승인</th>
|
||||
<th className="px-3 py-2">유형</th>
|
||||
<th className="px-3 py-2">성인</th>
|
||||
<th className="px-3 py-2">대분류 이동</th>
|
||||
<th className="px-3 py-2">활성</th>
|
||||
@@ -503,12 +502,6 @@ function BoardRowCells({ b, onDirty, onDelete, allowMove, categories, onMove, ma
|
||||
<td className="px-3 py-2 text-center"><input type="checkbox" checked={edit.allowAnonymousPost} onChange={(e) => { const v = { ...edit, allowAnonymousPost: e.target.checked }; setEdit(v); onDirty(b.id, v); }} /></td>
|
||||
<td className="px-3 py-2 text-center"><input type="checkbox" checked={edit.allowSecretComment} onChange={(e) => { const v = { ...edit, allowSecretComment: e.target.checked }; setEdit(v); onDirty(b.id, v); }} /></td>
|
||||
<td className="px-3 py-2 text-center"><input type="checkbox" checked={edit.requiresApproval} onChange={(e) => { const v = { ...edit, requiresApproval: e.target.checked }; setEdit(v); onDirty(b.id, v); }} /></td>
|
||||
<td className="px-3 py-2 text-center">
|
||||
<select className="h-9 rounded-md border border-neutral-300 px-2 text-sm" value={edit.type} onChange={(e) => { const v = { ...edit, type: e.target.value }; setEdit(v); onDirty(b.id, v); }}>
|
||||
<option value="general">general</option>
|
||||
<option value="special">special</option>
|
||||
</select>
|
||||
</td>
|
||||
<td className="px-3 py-2 text-center"><input type="checkbox" checked={!!edit.isAdultOnly} onChange={(e) => { const v = { ...edit, isAdultOnly: e.target.checked }; setEdit(v); onDirty(b.id, v); }} /></td>
|
||||
{allowMove && categories && onMove ? (
|
||||
<td className="px-3 py-2 text-center">
|
||||
|
||||
@@ -5,7 +5,7 @@ export async function PATCH(req: Request, context: { params: Promise<{ id: strin
|
||||
const { id } = await context.params;
|
||||
const body = await req.json().catch(() => ({}));
|
||||
const data: any = {};
|
||||
for (const k of ["name", "slug", "description", "sortOrder", "readLevel", "writeLevel", "allowAnonymousPost", "allowSecretComment", "requiresApproval", "status", "type", "isAdultOnly", "categoryId", "mainPageViewTypeId", "listViewTypeId"]) {
|
||||
for (const k of ["name", "slug", "description", "sortOrder", "readLevel", "writeLevel", "allowAnonymousPost", "allowSecretComment", "requiresApproval", "status", "isAdultOnly", "categoryId", "mainPageViewTypeId", "listViewTypeId"]) {
|
||||
if (k in body) data[k] = body[k];
|
||||
}
|
||||
if ("requiredTags" in body) {
|
||||
|
||||
@@ -17,7 +17,6 @@ export async function GET() {
|
||||
allowAnonymousPost: true,
|
||||
allowSecretComment: true,
|
||||
requiresApproval: true,
|
||||
type: true,
|
||||
status: true,
|
||||
categoryId: true,
|
||||
mainPageViewTypeId: true,
|
||||
@@ -39,7 +38,6 @@ const createSchema = z.object({
|
||||
allowSecretComment: z.boolean().optional(),
|
||||
requiresApproval: z.boolean().optional(),
|
||||
status: z.string().optional(),
|
||||
type: z.string().optional(),
|
||||
isAdultOnly: z.boolean().optional(),
|
||||
categoryId: z.string().nullable().optional(),
|
||||
});
|
||||
|
||||
@@ -20,7 +20,6 @@ export async function GET(req: Request) {
|
||||
name: true,
|
||||
slug: true,
|
||||
description: true,
|
||||
type: true,
|
||||
requiresApproval: true,
|
||||
allowAnonymousPost: true,
|
||||
isAdultOnly: true,
|
||||
|
||||
@@ -10,7 +10,7 @@ export async function GET() {
|
||||
boards: {
|
||||
where: { status: "active" },
|
||||
orderBy: [{ sortOrder: "asc" }, { createdAt: "asc" }],
|
||||
select: { id: true, name: true, slug: true, requiresApproval: true, type: true },
|
||||
select: { id: true, name: true, slug: true, requiresApproval: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ type ApiCategory = {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
boards: { id: string; name: string; slug: string; type: string; requiresApproval: boolean }[];
|
||||
boards: { id: string; name: string; slug: string; requiresApproval: boolean }[];
|
||||
};
|
||||
|
||||
type PostItem = {
|
||||
|
||||
Reference in New Issue
Block a user