diff --git a/src/controllers/05-quotation-controller.ts b/src/controllers/05-quotation-controller.ts index bf0f0e5..d60d6a5 100644 --- a/src/controllers/05-quotation-controller.ts +++ b/src/controllers/05-quotation-controller.ts @@ -168,13 +168,21 @@ const permissionCond = createPermCondition(globalAllow); export class QuotationController extends Controller { @Get("stats") @Security("keycloak") - async getProductStats(@Request() req: RequestWithUser) { + async getQuotationStats( + @Request() req: RequestWithUser, + @Query() startDate?: Date, + @Query() endDate?: Date, + ) { const result = await prisma.quotation.groupBy({ _count: true, by: "quotationStatus", where: { registeredBranch: isSystem(req.user) ? undefined : { OR: permissionCond(req.user) }, isDebitNote: false, + createdAt: { + gte: startDate, + lte: endDate, + }, }, });