Add song-level report triage

This commit is contained in:
Jonathan Sykes
2026-10-14 02:04:02 +08:00
parent 34b1173ea6
commit efac16ddaa
6 changed files with 73 additions and 7 deletions

View File

@@ -493,11 +493,15 @@ export async function listFlagsForVideo(videoId, status = 'open') {
}
// Newest first across every video; status 'all' returns both.
export async function listAllFlags({ status = 'open', limit = 200 } = {}) {
const where = status === 'all' ? '' : 'WHERE status = ?';
export async function listAllFlags({ status = 'open', limit = 200, olderThan = 0 } = {}) {
const filters = [];
const args = [];
if (status !== 'all') { filters.push('status = ?'); args.push(status); }
if (Number(olderThan) > 0) { filters.push('created_at <= ?'); args.push(Math.floor(Number(olderThan))); }
const where = filters.length ? `WHERE ${filters.join(' AND ')}` : '';
const r = await db.execute({
sql: `SELECT * FROM lyric_flags ${where} ORDER BY created_at DESC, id DESC LIMIT ?`,
args: status === 'all' ? [limit] : [status, limit],
args: [...args, limit],
});
return r.rows.map(flagRow);
}