no message

This commit is contained in:
Kittapath 2024-02-28 11:28:06 +07:00
parent 039b11d1c3
commit 98cfe8f639

View file

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