feat: add count of relation(s) to each record

This commit is contained in:
Methapon2001 2024-06-12 14:08:18 +07:00
parent f1245316a2
commit fc8e81b780
2 changed files with 2 additions and 0 deletions

View file

@ -134,6 +134,7 @@ export class CustomerBranchController extends Controller {
province: true,
district: true,
subDistrict: true,
_count: true,
},
where,
take: pageSize,

View file

@ -152,6 +152,7 @@ export class CustomerController extends Controller {
const [result, total] = await prisma.$transaction([
prisma.customer.findMany({
include: {
_count: true,
branch: includeBranch
? {
include: {