fix Orgcontroller

This commit is contained in:
AdisakKanthawilang 2024-01-26 12:00:43 +07:00
parent aca680f4f4
commit 22324853db
4 changed files with 7 additions and 12 deletions

View file

@ -82,7 +82,7 @@ export class OrgChild1Controller {
const chkCode = await this.child1Repository.findOne({
where: { id: id, orgChild1Code: requestBody.orgChild1Code },
});
if (chkCode != null) {
if (chkCode?.id != id && chkCode != null) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "รหัสหน่วยงานนี้มีอยู่ในระบบแล้ว");
}
const child1 = await this.child1Repository.findOne({ where: { id } });