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

@ -29,6 +29,38 @@ export class OrgRootController extends Controller {
private orgChild1Repository = AppDataSource.getRepository(OrgChild1);
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
/**
* API Root
*
* @summary ORG_016 - Root (ADMIN) #16
*
* @param {string} id Id Root
*/
@Get("root/{id}")
async GetRoot(@Path() id: string) {
try {
const orgRoot = await this.orgRootRepository.findOne({ where: { id } });
if (!orgRoot) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const getOrgRoot = {
"orgRootId" : orgRoot.id,
"orgRootName" : orgRoot.orgRootName,
"orgRootShortName" : orgRoot.orgRootShortName,
"orgRootCode" : orgRoot.orgRootCode,
"orgRootOrder" : orgRoot.orgRootOrder,
"orgRootPhoneEx" : orgRoot.orgRootPhoneEx,
"orgRootPhoneIn" : orgRoot.orgRootPhoneIn,
"orgRootFax" : orgRoot.orgRootFax,
"orgRevisionId" : orgRoot.orgRevisionId,
"orgCode" : orgRoot.orgRootCode+"00"
}
return new HttpSuccess(getOrgRoot);
} catch (error) {
return error;
}
}
/**
* Root
*