From d15273de1b9b6c3df82e3823a0aeffc26324a7cd Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 14 Aug 2024 20:40:31 +0700 Subject: [PATCH] fix: wrong field used --- src/controllers/branch-controller.ts | 2 +- src/controllers/product/product-controller.ts | 2 +- src/controllers/service/service-controller.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controllers/branch-controller.ts b/src/controllers/branch-controller.ts index 84f29d1..055fbfa 100644 --- a/src/controllers/branch-controller.ts +++ b/src/controllers/branch-controller.ts @@ -535,7 +535,7 @@ export class BranchController extends Controller { subDistrict: true, createdBy: true, updatedBy: true, - user: { where: { id: req.user.sub } }, + user: { where: { userId: req.user.sub } }, }, where: { id: branchId }, }); diff --git a/src/controllers/product/product-controller.ts b/src/controllers/product/product-controller.ts index c2e6e88..cd309ca 100644 --- a/src/controllers/product/product-controller.ts +++ b/src/controllers/product/product-controller.ts @@ -200,7 +200,7 @@ export class ProductController extends Controller { where: { id: body.productTypeId }, }), prisma.branch.findFirst({ - include: { user: { where: { id: req.user.sub } } }, + include: { user: { where: { userId: req.user.sub } } }, where: { id: body.registeredBranchId }, }), ]); diff --git a/src/controllers/service/service-controller.ts b/src/controllers/service/service-controller.ts index 2946add..feb7627 100644 --- a/src/controllers/service/service-controller.ts +++ b/src/controllers/service/service-controller.ts @@ -244,7 +244,7 @@ export class ServiceController extends Controller { where: { id: body.productTypeId }, }), prisma.branch.findFirst({ - include: { user: { where: { id: req.user.sub } } }, + include: { user: { where: { userId: req.user.sub } } }, where: { id: body.registeredBranchId }, }), ]);