Add song-level report triage
This commit is contained in:
10
server/db.js
10
server/db.js
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user