From 463e28c08902b473347f641a7d39188ec6a9464b Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Thu, 19 Sep 2024 14:25:41 +0700 Subject: [PATCH] fix: error required args --- src/controllers/03-customer-branch-citizen-controller.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controllers/03-customer-branch-citizen-controller.ts b/src/controllers/03-customer-branch-citizen-controller.ts index 2cf3163..dfc6e8d 100644 --- a/src/controllers/03-customer-branch-citizen-controller.ts +++ b/src/controllers/03-customer-branch-citizen-controller.ts @@ -90,9 +90,9 @@ export class CustomerBranchCitizenController extends Controller { async create(@Path() branchId: string, @Body() body: CustomerBranchCitizenPayload) { const { provinceId, districtId, subDistrictId, ...rest } = body; const [province, district, subDistrict] = await prisma.$transaction([ - prisma.province.findUnique({ where: { id: body.provinceId ?? undefined } }), - prisma.district.findUnique({ where: { id: body.districtId ?? undefined } }), - prisma.subDistrict.findUnique({ where: { id: body.subDistrictId ?? undefined } }), + prisma.province.findFirst({ where: { id: body.provinceId ?? undefined } }), + prisma.district.findFirst({ where: { id: body.districtId ?? undefined } }), + prisma.subDistrict.findFirst({ where: { id: body.subDistrictId ?? undefined } }), ]); if (body.provinceId && !province) throw relationError("Province"); if (body.districtId && !district) throw relationError("District");