MCPcopy
hub / github.com/nowork-studio/NotFair / claimProposedTask

Function claimProposedTask

notfair-cmo/src/server/db/tasks.ts:232–242  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

230 * read-back here cannot race with a concurrent writer in this process.
231 */
232export function claimProposedTask(id: string): Task | null {
233 const db = getDb();
234 const now = new Date().toISOString();
235 const info = db
236 .prepare(
237 "UPDATE tasks SET status = 'working', updated_at = ? WHERE id = ? AND status = 'proposed'",
238 )
239 .run(now, id);
240 if (info.changes === 0) return null;
241 return getTask(id);
242}
243
244/**
245 * Flip a working task to `blocked` (waiting on an approval). Only transitions

Callers 4

POSTFunction · 0.90
startTaskIfProposedFunction · 0.90
tasks.test.tsFile · 0.90

Calls 2

getDbFunction · 0.90
getTaskFunction · 0.85

Tested by

no test coverage detected