api รายละเอียดโครงสร้างระดับ root, ระดับ1-2

This commit is contained in:
Bright 2024-01-29 14:14:10 +07:00
parent 7cd4ae2b5f
commit 5b8e4cc3ad
3 changed files with 90 additions and 49 deletions

View file

@ -37,6 +37,38 @@ export class OrgChild2Controller extends Controller {
private child3Repository = AppDataSource.getRepository(OrgChild3);
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
/**
* API 2
*
* @summary ORG_018 - 2 (ADMIN) #20
*
* @param {string} id Id Child2
*/
@Get("{id}")
async GetChild2(@Path() id: string) {
try {
const orgChild2 = await this.child2Repository.findOne({ where: { id } });
if (!orgChild2) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const getOrgChild2 = {
"orgChild2Id" : orgChild2.id,
"orgChild2Name" : orgChild2.orgChild2Name,
"orgChild2ShortName" : orgChild2.orgChild2ShortName,
"orgChild2Code" : orgChild2.orgChild2Code,
"orgChild2Order" : orgChild2.orgChild2Order,
"orgChild2PhoneEx" : orgChild2.orgChild2PhoneEx,
"orgChild2PhoneIn" : orgChild2.orgChild2PhoneIn,
"orgChild2Fax" : orgChild2.orgChild2Fax,
"orgRevisionId" : orgChild2.orgRevisionId,
"orgCode" : orgChild2.orgChild2Code+"00"
}
return new HttpSuccess(getOrgChild2);
} catch (error) {
return error;
}
}
/**
* 2 Child2
*