f750b815d2
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
26 lines
731 B
TypeScript
26 lines
731 B
TypeScript
import { prisma } from "@/lib/db";
|
|
|
|
export async function GET() {
|
|
const rows = await prisma.discoverySuggestion.findMany({
|
|
where: { status: "pending" },
|
|
orderBy: [{ score: "desc" }, { createdAt: "asc" }],
|
|
});
|
|
const map = (r: (typeof rows)[number]) => ({
|
|
id: r.id,
|
|
artistMbid: r.artistMbid,
|
|
artistName: r.artistName,
|
|
rgMbid: r.rgMbid,
|
|
album: r.album,
|
|
primaryType: r.primaryType,
|
|
secondaryTypes: r.secondaryTypes,
|
|
firstReleaseDate: r.firstReleaseDate,
|
|
score: r.score,
|
|
seedCount: r.seedCount,
|
|
sources: r.sources,
|
|
});
|
|
return Response.json({
|
|
artists: rows.filter((r) => r.kind === "artist").map(map),
|
|
albums: rows.filter((r) => r.kind === "album").map(map),
|
|
});
|
|
}
|