Add recent outreach rejections stream

This commit is contained in:
jjbrunton committed 2026-08-14 15:45:57 +01:00
1 parent 0c21202253
commit 94049ed9c4
9 files changed
+170 -16

No files matched your search

@@ -480,6 +480,21 @@ export class CandidateQueueRepository {
return rows.map((row) => this.mapRow(row));
}
/** Most recently completed screening rejections for the operator audit stream. */
listRecentRejected(limit = 50): CandidateQueueRecord[] {
if (!Number.isInteger(limit) || limit < 1 || limit > 50) {
throw new Error('Rejected candidate limit must be an integer between 1 and 50');
}
const rows = this.db.prepare(`
SELECT * FROM candidate_queue
WHERE status = 'rejected'
AND COALESCE(last_error, '') NOT IN ('Cleared manually by operator', 'Removed manually by operator')
ORDER BY updated_at DESC, post_created_at DESC
LIMIT ?
`).all(limit) as Array<Record<string, unknown>>;
return rows.map((row) => this.mapRow(row));
}
private claim(
from: 'discovered' | 'ready',
to: 'screening' | 'sending',