From 85cc6efc1936d91b5cf713d26722cf55eec77c3c Mon Sep 17 00:00:00 2001 From: Timo Uttenweiler Date: Thu, 9 Apr 2026 11:45:04 +0200 Subject: [PATCH] Add debug logging to leads API --- app/api/leads/route.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/api/leads/route.ts b/app/api/leads/route.ts index 43388c5..d0bc570 100644 --- a/app/api/leads/route.ts +++ b/app/api/leads/route.ts @@ -79,7 +79,7 @@ export async function GET(req: NextRequest) { }; const orderByField = validSortFields[sortBy] ? sortBy : "capturedAt"; - const [total, leads] = await Promise.all([ + const [total, leads, rawCount] = await Promise.all([ prisma.lead.count({ where }), prisma.lead.findMany({ where, @@ -87,8 +87,11 @@ export async function GET(req: NextRequest) { skip: (page - 1) * perPage, take: perPage, }), + prisma.lead.count(), ]); + console.log(`[leads API] rawCount=${rawCount} total=${total} leads=${leads.length} where=${JSON.stringify(where)}`); + return NextResponse.json({ leads, total,