10.6 카테고리 유형/설정 관리(일반/특수/승인/레벨/익명/태그) o

This commit is contained in:
koreacomp5
2025-10-09 18:50:02 +09:00
parent a777c0ab73
commit c28698cd5c
3 changed files with 17 additions and 2 deletions

View File

@@ -27,6 +27,8 @@ export default function AdminBoardsPage() {
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
@@ -66,6 +68,13 @@ function Row({ b, onSave, saving }: { b: any; onSave: (b: any) => void; saving:
<td><input type="checkbox" checked={edit.allowAnonymousPost} onChange={(e) => setEdit({ ...edit, allowAnonymousPost: e.target.checked })} /></td>
<td><input type="checkbox" checked={edit.allowSecretComment} onChange={(e) => setEdit({ ...edit, allowSecretComment: e.target.checked })} /></td>
<td><input type="checkbox" checked={edit.requiresApproval} onChange={(e) => setEdit({ ...edit, requiresApproval: e.target.checked })} /></td>
<td>
<select value={edit.type} onChange={(e) => setEdit({ ...edit, type: e.target.value })}>
<option value="general">general</option>
<option value="special">special</option>
</select>
</td>
<td><input type="checkbox" checked={!!edit.isAdultOnly} onChange={(e) => setEdit({ ...edit, isAdultOnly: e.target.checked })} /></td>
<td><input type="number" value={edit.sortOrder} onChange={(e) => setEdit({ ...edit, sortOrder: Number(e.target.value) })} style={{ width: 80 }} /></td>
<td><button onClick={() => onSave(edit)} disabled={saving}>{saving ? "저장중" : "저장"}</button></td>
</tr>

View File

@@ -5,9 +5,15 @@ 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"]) {
for (const k of ["name", "slug", "description", "sortOrder", "readLevel", "writeLevel", "allowAnonymousPost", "allowSecretComment", "requiresApproval", "status", "type", "isAdultOnly"]) {
if (k in body) data[k] = body[k];
}
if ("requiredTags" in body) {
try { data.requiredTags = typeof body.requiredTags === "string" ? JSON.parse(body.requiredTags) : body.requiredTags; } catch { /* ignore invalid */ }
}
if ("requiredFields" in body) {
try { data.requiredFields = typeof body.requiredFields === "string" ? JSON.parse(body.requiredFields) : body.requiredFields; } catch { /* ignore invalid */ }
}
const updated = await prisma.board.update({ where: { id }, data });
return NextResponse.json({ board: updated });
}

View File

@@ -74,7 +74,7 @@
10.3 사용자 검색/정지/권한 변경 o
10.4 공지/배너 등록 및 노출 설정 o
10.5 감사 이력/신고 내역/열람 로그 o
10.6 카테고리 유형/설정 관리(일반/특수/승인/레벨/익명/태그)
10.6 카테고리 유형/설정 관리(일반/특수/승인/레벨/익명/태그) o
[테스트/품질]
11.1 유닛 테스트(서비스/리포지토리)