feat(reports): sales hasData existence flag (service + route)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
||||
getClosingThisMonth,
|
||||
getRecentWins,
|
||||
getLostReasonBreakdown,
|
||||
salesHasData,
|
||||
} from '@/lib/services/reports/sales.service';
|
||||
|
||||
/**
|
||||
@@ -87,6 +88,7 @@ export const GET = withAuth(
|
||||
recentWins,
|
||||
lostReasonBreakdown,
|
||||
priorKpis,
|
||||
hasData,
|
||||
] = await Promise.all([
|
||||
getSalesKpis(ctx.portId, range),
|
||||
getPipelineFunnel(ctx.portId),
|
||||
@@ -105,6 +107,7 @@ export const GET = withAuth(
|
||||
// with the main batch (depends only on the derived priorBounds);
|
||||
// resolves to null when the toggle is off so we pay nothing.
|
||||
priorBounds ? getSalesKpis(ctx.portId, priorBounds) : Promise.resolve(null),
|
||||
salesHasData(ctx.portId),
|
||||
]);
|
||||
|
||||
const comparison =
|
||||
@@ -134,6 +137,7 @@ export const GET = withAuth(
|
||||
closingThisMonth,
|
||||
recentWins,
|
||||
lostReasonBreakdown,
|
||||
hasData,
|
||||
range: {
|
||||
from: range.from.toISOString(),
|
||||
to: range.to.toISOString(),
|
||||
|
||||
Reference in New Issue
Block a user