feat: add count of relation(s) to each record
This commit is contained in:
parent
f1245316a2
commit
fc8e81b780
2 changed files with 2 additions and 0 deletions
|
|
@ -134,6 +134,7 @@ export class CustomerBranchController extends Controller {
|
|||
province: true,
|
||||
district: true,
|
||||
subDistrict: true,
|
||||
_count: true,
|
||||
},
|
||||
where,
|
||||
take: pageSize,
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ export class CustomerController extends Controller {
|
|||
const [result, total] = await prisma.$transaction([
|
||||
prisma.customer.findMany({
|
||||
include: {
|
||||
_count: true,
|
||||
branch: includeBranch
|
||||
? {
|
||||
include: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue