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");