제작된 퀴즈 5단계: 검토 대기(전체공개 퀴즈 → 서버 노래 DB). 저장할 때 DB에 없는 곡과 영상·제목·가수·직접 정한 하이라이트가 DB와 다른 곡을 모아 관리자가 항목마다 DB 유지/퀴즈 값을 고르거나 새 곡을 연도·장르·난이도와 함께 추가(퀴즈 곡이 그 DB 곡에 연결). 복수정답은 DB 별칭에, 한 번 정한 값은 다시 묻지 않음. 관리자 메뉴 '검토 대기'(개수 표시), 처리한 것 기록·감사 로그

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-22 13:07:41 +09:00
parent 4a40be696b
commit b999310eb9
10 changed files with 632 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ import { ConfirmSheet, Sheet } from '../../components/ui';
import { PlayRules, Section, Seg } from '../../components/RoomSettings';
import { YtPreview } from './SongsPage';
import { PositionEditor } from './PositionEditor';
import { useReviewCount } from './reviewCount';
const mmss = (s: number | null | undefined) => (s == null ? '-' : `${Math.floor(s / 60)}:${String(Math.round(s % 60)).padStart(2, '0')}`);
const VIS_LABEL: Record<QuizVisibility, string> = { private: '비공개', partial: '일부공개', public: '전체공개' };
@@ -172,13 +173,14 @@ export function QuizEditor() {
if (!draft) return false;
setBusy(true);
try {
const r = await apiCall<{ quiz: QuizDetail }>('PUT', `/api/admin/quizzes/${id}`, payload(draft));
const r = await apiCall<{ quiz: QuizDetail; reviews: { pending: number } }>('PUT', `/api/admin/quizzes/${id}`, payload(draft));
// keep the client keys (selection) of items that were already there, in order
const d = toDraft(r.quiz);
d.items = d.items.map((it, i) => ({ ...it, key: draft.items[i]?.key ?? it.key }));
setDraft(d);
setSaved(JSON.stringify(payload(d)));
toast('저장했어요.');
toast(r.reviews.pending ? `저장했어요. 서버 DB에 없거나 다른 곡 ${r.reviews.pending}곡이 관리자 검토 대기에 있어요.` : '저장했어요.');
useReviewCount.getState().refresh();
// DB facts of newly linked songs
const fresh = await apiCall<{ db: Record<number, DbInfo> }>('GET', `/api/admin/quizzes/${id}`);
setDb(fresh.db);