- 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>
34 lines
937 B
TypeScript
34 lines
937 B
TypeScript
import type { ClaudeJobStatus } from '@prisma/client'
|
|
|
|
const JOB_DB_TO_API = {
|
|
QUEUED: 'queued',
|
|
CLAIMED: 'claimed',
|
|
RUNNING: 'running',
|
|
DONE: 'done',
|
|
FAILED: 'failed',
|
|
CANCELLED: 'cancelled',
|
|
SKIPPED: 'skipped',
|
|
} as const satisfies Record<ClaudeJobStatus, string>
|
|
|
|
const JOB_API_TO_DB: Record<string, ClaudeJobStatus> = {
|
|
queued: 'QUEUED',
|
|
claimed: 'CLAIMED',
|
|
running: 'RUNNING',
|
|
done: 'DONE',
|
|
failed: 'FAILED',
|
|
cancelled: 'CANCELLED',
|
|
skipped: 'SKIPPED',
|
|
}
|
|
|
|
export type ClaudeJobStatusApi = typeof JOB_DB_TO_API[ClaudeJobStatus]
|
|
|
|
export function jobStatusToApi(s: ClaudeJobStatus): ClaudeJobStatusApi {
|
|
return JOB_DB_TO_API[s]
|
|
}
|
|
|
|
export function jobStatusFromApi(s: string): ClaudeJobStatus | null {
|
|
return JOB_API_TO_DB[s.toLowerCase()] ?? null
|
|
}
|
|
|
|
export const JOB_STATUS_API_VALUES = Object.values(JOB_DB_TO_API)
|
|
export const ACTIVE_JOB_STATUSES: ClaudeJobStatus[] = ['QUEUED', 'CLAIMED', 'RUNNING']
|