fix: error on not exist
This commit is contained in:
parent
58611f8589
commit
011d53d655
1 changed files with 4 additions and 0 deletions
|
|
@ -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: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue