แก้ไขสิทธิ์

This commit is contained in:
kittapath 2024-09-13 15:34:01 +07:00
parent 4641362b95
commit 0024ed9414
9 changed files with 154 additions and 27 deletions

View file

@ -623,9 +623,8 @@ export class OrganizationController extends Controller {
orgRevision.orgRevisionIsCurrent == true &&
orgRevision.orgRevisionIsDraft == false
) {
_data = await new permission().PermissionOrgList(request, "SYS_ORG");
await new permission().PermissionList(request, "SYS_ORG");
}
if (_data.root != null) {
if (orgRevision.orgRevisionIsDraft == true && orgRevision.orgRevisionIsCurrent == false) {
const profile = await this.profileRepo.findOne({
@ -636,7 +635,7 @@ export class OrganizationController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งานในทะเบียนประวัติ");
}
_data = {
root: [profile.permissionProfiles.map((x) => x.orgRootId)],
root: profile.permissionProfiles.map((x) => x.orgRootId),
child1: null,
child2: null,
child3: null,
@ -692,6 +691,7 @@ export class OrganizationController extends Controller {
)
.select([
"orgChild1.id",
"orgChild1.isOfficer",
"orgChild1.orgChild1Name",
"orgChild1.orgChild1ShortName",
"orgChild1.orgChild1Code",
@ -943,6 +943,7 @@ export class OrganizationController extends Controller {
orgRevisionId: orgRoot.orgRevisionId,
orgRootName: orgRoot.orgRootName,
responsibility: orgChild1.responsibility,
isOfficer: orgChild1.isOfficer,
labelName:
orgChild1.orgChild1Name +
" " +
@ -4737,4 +4738,22 @@ export class OrganizationController extends Controller {
return new HttpSuccess(formattedData);
}
/**
* API
*
* @summary - (ADMIN)
*
*/
@Get("check/child1/{id}")
async findIsOfficerChild1(@Path() id: string, @Request() request: RequestWithUser) {
const orgRevision = await this.orgRevisionRepository.findOne({
where: { id },
relations: ["orgChild1s"],
});
if (!orgRevision) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const check = orgRevision.orgChild1s.find((x) => x.isOfficer == true);
return new HttpSuccess(check != null);
}
}