diff --git a/src/controllers/OrgChild3Controller.ts b/src/controllers/OrgChild3Controller.ts index 46a168e4..3a929aa3 100644 --- a/src/controllers/OrgChild3Controller.ts +++ b/src/controllers/OrgChild3Controller.ts @@ -35,6 +35,38 @@ export class OrgChild3Controller { private child4Repository = AppDataSource.getRepository(OrgChild4); private orgRevisionRepository = AppDataSource.getRepository(OrgRevision); + /** + * API รายละเอียดโครงสร้างระดับ 3 + * + * @summary ORG_019 - รายละเอียดโครงสร้างระดับ3 (ADMIN) #18 + * + * @param {string} id Id Child3 + */ + @Get("{id}") + async GetChild3(@Path() id: string) { + try { + const orgChild3 = await this.child3Repository.findOne({ where: { id } }); + if (!orgChild3) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); + } + const getOrgChild3 = { + "orgChild3Id" : orgChild3.id, + "orgChild3Name" : orgChild3.orgChild3Name, + "orgChild3ShortName" : orgChild3.orgChild3ShortName, + "orgChild3Code" : orgChild3.orgChild3Code, + "orgChild3Order" : orgChild3.orgChild3Order, + "orgChild3PhoneEx" : orgChild3.orgChild3PhoneEx, + "orgChild3PhoneIn" : orgChild3.orgChild3PhoneIn, + "orgChild3Fax" : orgChild3.orgChild3Fax, + "orgRevisionId" : orgChild3.orgRevisionId, + "orgCode" : orgChild3.orgChild3Code+"00" + } + return new HttpSuccess(getOrgChild3); + } catch (error) { + return error; + } + } + /** * API สร้างโครงสร้างระดับ3 * diff --git a/src/controllers/OrgChild4Controller.ts b/src/controllers/OrgChild4Controller.ts index 8af06bfe..bcfbc085 100644 --- a/src/controllers/OrgChild4Controller.ts +++ b/src/controllers/OrgChild4Controller.ts @@ -37,6 +37,38 @@ export class OrgChild4Controller extends Controller { private child4Repository = AppDataSource.getRepository(OrgChild4); private orgRevisionRepository = AppDataSource.getRepository(OrgRevision); + /** + * API รายละเอียดโครงสร้างระดับ 4 + * + * @summary ORG_019 - รายละเอียดโครงสร้างระดับ4 (ADMIN) #26 + * + * @param {string} id Id Child4 + */ + @Get("{id}") + async GetChild4(@Path() id: string) { + try { + const orgChild4 = await this.child4Repository.findOne({ where: { id } }); + if (!orgChild4) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); + } + const getOrgChild4 = { + "orgChild4Id" : orgChild4.id, + "orgChild4Name" : orgChild4.orgChild4Name, + "orgChild4ShortName" : orgChild4.orgChild4ShortName, + "orgChild4Code" : orgChild4.orgChild4Code, + "orgChild4Order" : orgChild4.orgChild4Order, + "orgChild4PhoneEx" : orgChild4.orgChild4PhoneEx, + "orgChild4PhoneIn" : orgChild4.orgChild4PhoneIn, + "orgChild4Fax" : orgChild4.orgChild4Fax, + "orgRevisionId" : orgChild4.orgRevisionId, + "orgCode" : orgChild4.orgChild4Code+"00" + } + return new HttpSuccess(getOrgChild4); + } catch (error) { + return error; + } + } + /** * สร้างโครงสร้างระดับ4 Child4 *