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:
@@ -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 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user