10.6 카테고리 유형/설정 관리(일반/특수/승인/레벨/익명/태그) o
This commit is contained in:
@@ -27,6 +27,8 @@ export default function AdminBoardsPage() {
|
|||||||
<th>익명</th>
|
<th>익명</th>
|
||||||
<th>비밀댓</th>
|
<th>비밀댓</th>
|
||||||
<th>승인</th>
|
<th>승인</th>
|
||||||
|
<th>유형</th>
|
||||||
|
<th>성인</th>
|
||||||
<th>정렬</th>
|
<th>정렬</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</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.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.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><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><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>
|
<td><button onClick={() => onSave(edit)} disabled={saving}>{saving ? "저장중" : "저장"}</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -5,9 +5,15 @@ export async function PATCH(req: Request, context: { params: Promise<{ id: strin
|
|||||||
const { id } = await context.params;
|
const { id } = await context.params;
|
||||||
const body = await req.json().catch(() => ({}));
|
const body = await req.json().catch(() => ({}));
|
||||||
const data: any = {};
|
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 (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 });
|
const updated = await prisma.board.update({ where: { id }, data });
|
||||||
return NextResponse.json({ board: updated });
|
return NextResponse.json({ board: updated });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
10.3 사용자 검색/정지/권한 변경 o
|
10.3 사용자 검색/정지/권한 변경 o
|
||||||
10.4 공지/배너 등록 및 노출 설정 o
|
10.4 공지/배너 등록 및 노출 설정 o
|
||||||
10.5 감사 이력/신고 내역/열람 로그 o
|
10.5 감사 이력/신고 내역/열람 로그 o
|
||||||
10.6 카테고리 유형/설정 관리(일반/특수/승인/레벨/익명/태그)
|
10.6 카테고리 유형/설정 관리(일반/특수/승인/레벨/익명/태그) o
|
||||||
|
|
||||||
[테스트/품질]
|
[테스트/품질]
|
||||||
11.1 유닛 테스트(서비스/리포지토리)
|
11.1 유닛 테스트(서비스/리포지토리)
|
||||||
|
|||||||
Reference in New Issue
Block a user