fix: error fk on empty payload registeredBranch field
This commit is contained in:
parent
e509cd1fd5
commit
7d7ac384c3
1 changed files with 4 additions and 1 deletions
|
|
@ -296,13 +296,16 @@ export class CustomerController extends Controller {
|
||||||
"relationSubDistrictNotFound",
|
"relationSubDistrictNotFound",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (body.registeredBranchId && !branch) {
|
if (!!body.registeredBranchId && !branch) {
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
HttpStatus.BAD_REQUEST,
|
HttpStatus.BAD_REQUEST,
|
||||||
"Branch cannot be found.",
|
"Branch cannot be found.",
|
||||||
"relationBranchNotFound",
|
"relationBranchNotFound",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (!body.registeredBranchId) {
|
||||||
|
body.registeredBranchId = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
const record = await prisma.$transaction(
|
const record = await prisma.$transaction(
|
||||||
async (tx) => {
|
async (tx) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue