feat: filter date
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 7s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 7s
This commit is contained in:
parent
a979c60143
commit
2beaf6d26c
1 changed files with 9 additions and 1 deletions
|
|
@ -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,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue