제목 정리 4단계: 서버 DB 곡 제목 정리 검토 — title_reviews(015), songs/title-review.ts(만들기·적용·건너뛰기·목록), cli clean-titles(--review: 모두 검토 목록 / 기본: 새 곡은 바로 반영, 일본어·확인 필요만 검토), 관리자 → 수집에 '제목 정리·정답 만들기', 관리자 → ✏️ 제목 정리(묶음별 목록, 제목·가수 고쳐서 적용, 건너뛰기, 묶음 전체 적용, 처리한 것). 적용하면 제목·가수와 새 정답·원래 이름(별칭), match_key는 그대로, 그사이 바뀐 곡은 적용 안 함. 영어 발음 다듬기(운영 사본 표본에서): 자음 뒤 l(플렉스·블루), s+w(스위트), ts(렛츠), ow+모음(플라워), 철자 o의 ɑ는 ㅗ(존·아이콘), 약모음은 철자대로(프로미스·사이렌), 단어 끝 -sle/-zle(캐슬), 대문자 한 글자는 글자 이름(알 오 디), 아포스트로피는 's/'t 등만. 단위·API 테스트, e2e admin(제목 정리), docs 13
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import { z } from 'zod';
|
||||
import type { Role } from '@mq/shared';
|
||||
import type { AdminDeps } from './admin';
|
||||
import { genreList, listSongs, type SongFilter } from '../songs/store';
|
||||
import { TITLE_REVIEW_KINDS, applyTitleReviews, listTitleReviews, skipTitleReviews, type TitleReviewKind } from '../songs/title-review';
|
||||
import {
|
||||
addGenre,
|
||||
bulk,
|
||||
@@ -293,6 +294,36 @@ export function mountCatalogAdmin(
|
||||
return c.json({ ok: true });
|
||||
});
|
||||
|
||||
// ------------------------------------------------------------ 제목 정리 검토 (docs/13)
|
||||
const kindIds = TITLE_REVIEW_KINDS.map((k) => k.id) as [TitleReviewKind, ...TitleReviewKind[]];
|
||||
app.get('/title-reviews', (c) => {
|
||||
const kind = kindIds.includes(c.req.query('kind') as TitleReviewKind) ? (c.req.query('kind') as TitleReviewKind) : undefined;
|
||||
const r = listTitleReviews(d.db, { kind, status: c.req.query('status') === 'done' ? 'done' : 'pending', page: Number(c.req.query('page') ?? 0) || 0 });
|
||||
return c.json({ ...r, kinds: TITLE_REVIEW_KINDS });
|
||||
});
|
||||
app.post('/title-reviews/apply', async (c) => {
|
||||
const p = z
|
||||
.object({
|
||||
ids: z.array(z.number().int()).max(5000).optional(),
|
||||
kind: z.enum(kindIds).optional(),
|
||||
edits: z.array(z.object({ id: z.number().int(), title: z.string().trim().max(200).optional(), artist: z.string().trim().max(200).optional() })).max(5000).optional(),
|
||||
})
|
||||
.refine((x) => x.ids?.length || x.kind, '곡이나 묶음을 골라 주세요.')
|
||||
.safeParse(await h.body(c));
|
||||
if (!p.success) return c.json({ error: '곡이나 묶음을 골라 주세요.' }, 400);
|
||||
const r = applyTitleReviews(d.db, p.data, h.actor(c));
|
||||
d.audit.log(h.actor(c), 'title-review.apply', p.data.kind ?? null, null, { ids: p.data.ids?.length ?? null, kind: p.data.kind ?? null, applied: r.applied });
|
||||
d.onCatalogChange?.();
|
||||
return c.json(r);
|
||||
});
|
||||
app.post('/title-reviews/skip', async (c) => {
|
||||
const p = z.object({ ids: z.array(z.number().int()).min(1).max(5000) }).safeParse(await h.body(c));
|
||||
if (!p.success) return c.json({ error: '곡을 골라 주세요.' }, 400);
|
||||
const n = skipTitleReviews(d.db, p.data.ids, h.actor(c));
|
||||
d.audit.log(h.actor(c), 'title-review.skip', null, null, { ids: p.data.ids.length, skipped: n });
|
||||
return c.json({ skipped: n });
|
||||
});
|
||||
|
||||
// ------------------------------------------------------------ collect (수집 실행·멈추기·기록)
|
||||
app.get('/collect', (c) => {
|
||||
const jobs = d.db
|
||||
|
||||
Reference in New Issue
Block a user