แก้ฟิลด์ orgCode

This commit is contained in:
Bright 2024-01-29 14:55:13 +07:00
parent 5a7e5cfa0e
commit e82b4f6a85
5 changed files with 31 additions and 9 deletions

View file

@ -50,7 +50,11 @@ export class OrgChild1Controller {
try {
const orgChild1 = await this.child1Repository.findOne({ where: { id } });
if (!orgChild1) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล โครงสร้างระดับ 1");
}
const orgRoot = await this.orgRootRepository.findOne({ where: { id: orgChild1.orgRootId } });
if (!orgRoot) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล โครงสร้างระดับ Root");
}
const getOrgChild1 = {
"orgChild1Id" : orgChild1.id,
@ -62,7 +66,7 @@ export class OrgChild1Controller {
"orgChild1PhoneIn" : orgChild1.orgChild1PhoneIn,
"orgChild1Fax" : orgChild1.orgChild1Fax,
"orgRevisionId" : orgChild1.orgRevisionId,
"orgCode" : orgChild1.orgChild1Code+"00"
"orgCode" : orgRoot.orgRootCode + orgChild1.orgChild1Code
}
return new HttpSuccess(getOrgChild1);
} catch (error) {