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, province: true,
district: true, district: true,
subDistrict: true, subDistrict: true,
_count: true,
}, },
where, where,
take: pageSize, take: pageSize,

View file

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