no message
This commit is contained in:
parent
5cb6126b39
commit
16324a09fd
2 changed files with 121 additions and 16 deletions
|
|
@ -2831,4 +2831,36 @@ export class OrganizationController extends Controller {
|
|||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* API หาสำนักทั้งหมด
|
||||
*
|
||||
* @summary หาสำนักทั้งหมด
|
||||
*
|
||||
*/
|
||||
@Get("active/root")
|
||||
async GetActiveRoot() {
|
||||
try {
|
||||
const orgRevisionActive = await this.orgRevisionRepository.findOne({
|
||||
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
|
||||
});
|
||||
if (!orgRevisionActive) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบโครงสร้างที่เผยแพร๋อยู่ตอนนี้");
|
||||
}
|
||||
|
||||
const data = await this.orgRootRepository.find({
|
||||
where: { orgRevisionId: orgRevisionActive.id },
|
||||
relations: [
|
||||
"orgRevision",
|
||||
"orgChild1s",
|
||||
"orgChild1s.orgChild2s",
|
||||
"orgChild1s.orgChild2s.orgChild3s",
|
||||
"orgChild1s.orgChild2s.orgChild3s.orgChild4s",
|
||||
],
|
||||
});
|
||||
return new HttpSuccess(data);
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue