Merge branch 'develop' into adiDev
This commit is contained in:
commit
1c9a4d47cc
1 changed files with 25 additions and 0 deletions
|
|
@ -2864,6 +2864,31 @@ export class OrganizationController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* API หาสำนักทั้งหมด
|
||||
*
|
||||
* @summary หาสำนักทั้งหมด
|
||||
*
|
||||
*/
|
||||
@Get("active/root/id")
|
||||
async GetActiveRootId() {
|
||||
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 },
|
||||
});
|
||||
return new HttpSuccess(data.map((x) => x.id));
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* API หาสำนักทั้งหมด by revision
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue