feat: real worker status, covers on Recently Pressed, library counter
- Worker stamps a throttled worker.heartbeat; GET /api/worker reports online from its updatedAt recency (DB-time); masthead shows a live listening/offline dot instead of a static decoration. - /api/requests enriched with rgMbid; Recently Pressed shows cover thumbs. - Library album count moved from the filter row into a section header. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -35,10 +35,11 @@ export async function POST(request: Request) {
|
||||
}
|
||||
|
||||
export async function GET() {
|
||||
const requests = await prisma.request.findMany({
|
||||
orderBy: { createdAt: "desc" },
|
||||
include: { job: true },
|
||||
});
|
||||
const [requests, releases] = await Promise.all([
|
||||
prisma.request.findMany({ orderBy: { createdAt: "desc" }, include: { job: true } }),
|
||||
prisma.monitoredRelease.findMany({ select: { artistName: true, album: true, rgMbid: true } }),
|
||||
]);
|
||||
const rgByKey = new Map(releases.map((mr) => [`${mr.artistName} ${mr.album}`, mr.rgMbid]));
|
||||
|
||||
return Response.json({
|
||||
requests: requests.map((r) => ({
|
||||
@@ -47,6 +48,7 @@ export async function GET() {
|
||||
album: r.album,
|
||||
status: r.status,
|
||||
createdAt: r.createdAt,
|
||||
rgMbid: rgByKey.get(`${r.artist} ${r.album}`) ?? null,
|
||||
job: r.job ? { state: r.job.state, currentStage: r.job.currentStage } : null,
|
||||
})),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user