diff --git a/src/controllers/customer-controller.ts b/src/controllers/customer-controller.ts index 06e2f20..ca10da2 100644 --- a/src/controllers/customer-controller.ts +++ b/src/controllers/customer-controller.ts @@ -296,13 +296,16 @@ export class CustomerController extends Controller { "relationSubDistrictNotFound", ); } - if (body.registeredBranchId && !branch) { + if (!!body.registeredBranchId && !branch) { throw new HttpError( HttpStatus.BAD_REQUEST, "Branch cannot be found.", "relationBranchNotFound", ); } + if (!body.registeredBranchId) { + body.registeredBranchId = undefined; + } const record = await prisma.$transaction( async (tx) => {