From 5a7e5cfa0eb05b3a2b2263f3abf893949b9bbe3c Mon Sep 17 00:00:00 2001 From: Bright Date: Mon, 29 Jan 2024 14:26:38 +0700 Subject: [PATCH] =?UTF-8?q?api=20=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=A5?= =?UTF-8?q?=E0=B8=B0=E0=B9=80=E0=B8=AD=E0=B8=B5=E0=B8=A2=E0=B8=94=E0=B9=82?= =?UTF-8?q?=E0=B8=84=E0=B8=A3=E0=B8=87=E0=B8=AA=E0=B8=A3=E0=B9=89=E0=B8=B2?= =?UTF-8?q?=E0=B8=87=E0=B8=A3=E0=B8=B0=E0=B8=94=E0=B8=B1=E0=B8=9A=203-4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/OrgChild3Controller.ts | 32 ++++++++++++++++++++++++++ src/controllers/OrgChild4Controller.ts | 32 ++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) 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 *