Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2024-02-28 11:31:43 +07:00
commit 1c9a4d47cc

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
*