fix: condition not cover

This commit is contained in:
Methapon2001 2024-08-08 15:48:41 +07:00
parent a065df3b1f
commit bcd765c71a

View file

@ -330,6 +330,14 @@ export class BranchController extends Controller {
);
}
if (last.value !== 1 && !headOfficeId) {
throw new HttpError(
HttpStatus.BAD_REQUEST,
"Branch with same code already exists.",
"sameBranchCodeExists",
);
}
return await tx.branch.create({
include: {
province: true,