[taskboard] add dispatch control plane

This commit is contained in:
2026-03-06 15:21:19 -08:00
parent 1699f0f2b7
commit be1cf8ca8d
25 changed files with 1594 additions and 292 deletions

View File

@@ -0,0 +1,21 @@
import { NextResponse } from "next/server";
import { dispatchTask } from "@/lib/dispatch";
export async function POST(
_request: Request,
{ params }: { params: Promise<{ id: string }> },
) {
const { id } = await params;
const numericId = Number(id);
if (!Number.isInteger(numericId) || numericId <= 0) {
return NextResponse.json({ error: "invalid_task_id" }, { status: 400 });
}
try {
return NextResponse.json(await dispatchTask(numericId));
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
return NextResponse.json({ error: "dispatch_failed", detail: message }, { status: 500 });
}
}