หา root
This commit is contained in:
parent
8d48dc8af7
commit
c38eae7498
1 changed files with 21 additions and 0 deletions
|
|
@ -5520,6 +5520,27 @@ export class OrganizationController extends Controller {
|
|||
return new HttpSuccess(data.map((x) => x.id));
|
||||
}
|
||||
|
||||
/**
|
||||
* API หาสำนักทั้งหมด
|
||||
*
|
||||
* @summary หาสำนักทั้งหมด
|
||||
*
|
||||
*/
|
||||
@Get("active/root/all")
|
||||
async GetActiveRootAll() {
|
||||
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 },
|
||||
});
|
||||
return new HttpSuccess(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* API
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue