api รายละเอียดโครงสร้างระดับ root, ระดับ1-2
This commit is contained in:
parent
7cd4ae2b5f
commit
5b8e4cc3ad
3 changed files with 90 additions and 49 deletions
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue