feat: add task workflow and asset downloads
This commit is contained in:
1 parent
f9c3393f84
commit
63e62d444c
61 files changed
+2773
-2181
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import { jsonError, jsonOk, readJsonBody } from "@/lib/server/api";
|
||||
import { assertInternalWorkerToken, PublicApiAuthError } from "@/lib/server/public-api-auth";
|
||||
import { runWorkerTick } from "@/lib/server/task-manager";
|
||||
|
||||
export const runtime = "nodejs";
|
||||
|
||||
export async function POST(request: Request) {
|
||||
try {
|
||||
assertInternalWorkerToken(request);
|
||||
const body = await readJsonBody<{
|
||||
workerId?: string;
|
||||
limit?: number;
|
||||
}>(request);
|
||||
const result = await runWorkerTick({
|
||||
request,
|
||||
workerId: body.workerId,
|
||||
limit: typeof body.limit === "number" ? body.limit : undefined
|
||||
});
|
||||
return jsonOk(result);
|
||||
} catch (error) {
|
||||
if (error instanceof PublicApiAuthError) return jsonError(error.message, error.status);
|
||||
return jsonError(error, 500);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user