หา สกจ root
This commit is contained in:
parent
eab9b79aa7
commit
398c4d6994
1 changed files with 36 additions and 1 deletions
|
|
@ -922,7 +922,8 @@ export class WorkflowController extends Controller {
|
|||
},
|
||||
relations: ["orgChild1"],
|
||||
});
|
||||
if (!profileOfficer) return new HttpSuccess({ isOfficer: false, isStaff: false });
|
||||
if (!profileOfficer)
|
||||
return new HttpSuccess({ isOfficer: false, isStaff: false, isDirector: false });
|
||||
let isOfficer = profileOfficer.orgChild1 == null ? false : profileOfficer.orgChild1.isOfficer;
|
||||
return new HttpSuccess({
|
||||
isOfficer: isOfficer,
|
||||
|
|
@ -931,6 +932,40 @@ export class WorkflowController extends Controller {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* API เช็ค สกจ
|
||||
*
|
||||
* @summary เช็ค สกจ
|
||||
*
|
||||
*/
|
||||
@Get("keycloak/isofficer-root/{system}")
|
||||
async getIsOfficerByKeycloakRoot(@Path() system: string, @Request() req: RequestWithUser) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: {
|
||||
keycloak: req.user.sub,
|
||||
},
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งาน");
|
||||
|
||||
const profileOfficer = await this.posMasterRepo.findOne({
|
||||
where: {
|
||||
posMasterAssigns: { assignId: system },
|
||||
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
|
||||
current_holderId: profile.id,
|
||||
},
|
||||
relations: ["orgChild1"],
|
||||
});
|
||||
if (!profileOfficer)
|
||||
return new HttpSuccess({ isOfficer: false, isStaff: false, isDirector: false });
|
||||
let isOfficer = profileOfficer.orgChild1 == null ? false : profileOfficer.orgChild1.isOfficer;
|
||||
return new HttpSuccess({
|
||||
isOfficer: isOfficer,
|
||||
isStaff: !isOfficer,
|
||||
isDirector:
|
||||
!profileOfficer.orgChild1Id && profileOfficer.orgRootId ? profileOfficer.isDirector : false,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* API เช็ค สกจ
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue