From 818dd044b69dff6f2bc681e646ab39e84b0fd26e Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 6 Jun 2024 17:09:47 +0700 Subject: [PATCH] feat: scope customer branch by customer id --- src/controllers/customer-branch-controller.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/controllers/customer-branch-controller.ts b/src/controllers/customer-branch-controller.ts index 2a2371b..27aaae0 100644 --- a/src/controllers/customer-branch-controller.ts +++ b/src/controllers/customer-branch-controller.ts @@ -106,6 +106,7 @@ export class CustomerBranchController extends Controller { @Get() async list( @Query() zipCode?: string, + @Query() customerId?: string, @Query() query: string = "", @Query() page: number = 1, @Query() pageSize: number = 30, @@ -116,7 +117,8 @@ export class CustomerBranchController extends Controller { { name: { contains: query }, zipCode }, { email: { contains: query }, zipCode }, ], - } satisfies Prisma.BranchWhereInput; + AND: { customerId }, + } satisfies Prisma.CustomerBranchWhereInput; const [result, total] = await prisma.$transaction([ prisma.customerBranch.findMany({