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,
|
province: true,
|
||||||
district: true,
|
district: true,
|
||||||
subDistrict: true,
|
subDistrict: true,
|
||||||
|
_count: true,
|
||||||
},
|
},
|
||||||
where,
|
where,
|
||||||
take: pageSize,
|
take: pageSize,
|
||||||
|
|
|
||||||
|
|
@ -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: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue