หา root

This commit is contained in:
kittapath 2024-11-13 11:56:22 +07:00
parent 8d48dc8af7
commit c38eae7498

View file

@ -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
*