- lib/job-status.ts: SKIPPED ↔ 'skipped' mapping in beide richtingen - components/shared/job-status.ts: label "Overgeslagen" + neutrale italic styling - actions/admin/jobs.ts: cancel-guard erkent SKIPPED als eindstatus - app/api/cron/cleanup-agent-artifacts: SKIPPED ook opruimen na 7d - lib/insights/agent-throughput: SKIPPED telt mee als terminal ACTIVE_JOB_STATUSES bewust ongewijzigd — SKIPPED is afgerond. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
24 lines
694 B
TypeScript
24 lines
694 B
TypeScript
import { prisma } from '@/lib/prisma'
|
|
|
|
export const runtime = 'nodejs'
|
|
|
|
const CUTOFF_DAYS = 7
|
|
|
|
export async function POST(request: Request) {
|
|
const auth = request.headers.get('authorization')
|
|
const expected = process.env.CRON_SECRET
|
|
if (!expected || auth !== `Bearer ${expected}`) {
|
|
return Response.json({ error: 'Unauthorized' }, { status: 401 })
|
|
}
|
|
|
|
const cutoff = new Date(Date.now() - CUTOFF_DAYS * 24 * 60 * 60 * 1000)
|
|
|
|
const { count: deleted } = await prisma.claudeJob.deleteMany({
|
|
where: {
|
|
status: { in: ['FAILED', 'CANCELLED', 'SKIPPED'] },
|
|
finished_at: { lt: cutoff },
|
|
},
|
|
})
|
|
|
|
return Response.json({ deleted, ran_at: new Date().toISOString() })
|
|
}
|