Jobs API: expose getJob and listRecentJobs; use unified queue module for job status and history; UI can query /api/jobs?ticker=...\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This commit is contained in:
2026-05-16 14:47:23 +02:00
parent 9771f48028
commit 669b792045
3 changed files with 33 additions and 6 deletions
+14
View File
@@ -0,0 +1,14 @@
import { listRecentJobs } from "../../../lib/queue";
export async function loader({ request }: { request: Request }) {
const url = new URL(request.url);
const ticker = url.searchParams.get("ticker") || undefined;
const limit = parseInt(url.searchParams.get("limit") || "50", 10);
try {
const jobs = await listRecentJobs(ticker || undefined, limit);
return Response.json({ jobs });
} catch (err) {
console.error("/api/jobs index error:", err);
return Response.json({ error: "internal" }, { status: 500 });
}
}