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 orderByField = validSortFields[sortBy] ? sortBy : "capturedAt";
|
||||||
|
|
||||||
const [total, leads] = await Promise.all([
|
const [total, leads, rawCount] = await Promise.all([
|
||||||
prisma.lead.count({ where }),
|
prisma.lead.count({ where }),
|
||||||
prisma.lead.findMany({
|
prisma.lead.findMany({
|
||||||
where,
|
where,
|
||||||
@@ -87,8 +87,11 @@ export async function GET(req: NextRequest) {
|
|||||||
skip: (page - 1) * perPage,
|
skip: (page - 1) * perPage,
|
||||||
take: perPage,
|
take: perPage,
|
||||||
}),
|
}),
|
||||||
|
prisma.lead.count(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
console.log(`[leads API] rawCount=${rawCount} total=${total} leads=${leads.length} where=${JSON.stringify(where)}`);
|
||||||
|
|
||||||
return NextResponse.json({
|
return NextResponse.json({
|
||||||
leads,
|
leads,
|
||||||
total,
|
total,
|
||||||
|
|||||||
Reference in New Issue
Block a user