diff --git a/src/controllers/customer-branch-controller.ts b/src/controllers/customer-branch-controller.ts index 642d63d..4312eb6 100644 --- a/src/controllers/customer-branch-controller.ts +++ b/src/controllers/customer-branch-controller.ts @@ -194,6 +194,10 @@ export class CustomerBranchController extends Controller { const { provinceId, districtId, subDistrictId, customerId, ...rest } = body; + if (!(await prisma.customerBranch.findUnique({ where: { id: branchId } }))) { + throw new HttpError(HttpStatus.NOT_FOUND, "Branch cannot be found.", "data_not_found"); + } + const record = await prisma.customerBranch.update({ where: { id: branchId }, include: {