fix: relation
This commit is contained in:
parent
5b6c7e7ac8
commit
ddec8275d8
1 changed files with 8 additions and 4 deletions
|
|
@ -304,19 +304,19 @@ export class EmployeeController extends Controller {
|
||||||
include: { customer: true },
|
include: { customer: true },
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
if (body.provinceId && !province)
|
if (body.provinceId !== province?.id)
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
HttpStatus.BAD_REQUEST,
|
HttpStatus.BAD_REQUEST,
|
||||||
"Province cannot be found.",
|
"Province cannot be found.",
|
||||||
"missing_or_invalid_parameter",
|
"missing_or_invalid_parameter",
|
||||||
);
|
);
|
||||||
if (body.districtId && !district)
|
if (body.districtId !== district?.id)
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
HttpStatus.BAD_REQUEST,
|
HttpStatus.BAD_REQUEST,
|
||||||
"District cannot be found.",
|
"District cannot be found.",
|
||||||
"missing_or_invalid_parameter",
|
"missing_or_invalid_parameter",
|
||||||
);
|
);
|
||||||
if (body.subDistrictId && !subDistrict)
|
if (body.subDistrictId !== subDistrict?.id)
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
HttpStatus.BAD_REQUEST,
|
HttpStatus.BAD_REQUEST,
|
||||||
"Sub-district cannot be found.",
|
"Sub-district cannot be found.",
|
||||||
|
|
@ -395,7 +395,11 @@ export class EmployeeController extends Controller {
|
||||||
},
|
},
|
||||||
employeeCheckup: {
|
employeeCheckup: {
|
||||||
createMany: {
|
createMany: {
|
||||||
data: employeeCheckup || [],
|
data:
|
||||||
|
employeeCheckup?.map((v) => ({
|
||||||
|
...v,
|
||||||
|
provinceId: !!v.provinceId ? null : v.provinceId,
|
||||||
|
})) || [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
employeeOtherInfo: {
|
employeeOtherInfo: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue