fix: order
This commit is contained in:
parent
b36b6f9f07
commit
e9889a1682
1 changed files with 18 additions and 2 deletions
|
|
@ -28,6 +28,7 @@ export class StatsController extends Controller {
|
|||
registeredBranch: { OR: permissionCondCompany(req.user) },
|
||||
createdAt: { gte: startDate, lte: endDate },
|
||||
},
|
||||
orderBy: { createdAt: 'desc' },
|
||||
take: limit,
|
||||
});
|
||||
|
||||
|
|
@ -64,6 +65,7 @@ export class StatsController extends Controller {
|
|||
},
|
||||
createdAt: { gte: startDate, lte: endDate },
|
||||
},
|
||||
orderBy: { createdAt: 'desc' },
|
||||
take: limit,
|
||||
});
|
||||
|
||||
|
|
@ -98,6 +100,7 @@ export class StatsController extends Controller {
|
|||
},
|
||||
createdAt: { gte: startDate, lte: endDate },
|
||||
},
|
||||
orderBy: { createdAt: 'desc' },
|
||||
take: limit,
|
||||
});
|
||||
|
||||
|
|
@ -117,6 +120,13 @@ export class StatsController extends Controller {
|
|||
@Query() endDate?: Date,
|
||||
) {
|
||||
const record = await prisma.product.findMany({
|
||||
include: {
|
||||
quotationProductServiceList: {
|
||||
include: {
|
||||
quotation: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
code: true,
|
||||
|
|
@ -142,9 +152,15 @@ export class StatsController extends Controller {
|
|||
},
|
||||
},
|
||||
where: {
|
||||
quotationProductServiceList: { some: {} },
|
||||
quotationProductServiceList: {
|
||||
some: {
|
||||
quotation: { createdAt: { gte: startDate, lte: endDate } },
|
||||
},
|
||||
},
|
||||
productGroup: { registeredBranch: { OR: permissionCondCompany(req.user) } },
|
||||
createdAt: { gte: startDate, lte: endDate },
|
||||
},
|
||||
orderBy: {
|
||||
quotationProductServiceList: { _count: "desc" },
|
||||
},
|
||||
take: limit,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue