Add debug logging to leads API
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user