add permissionProfile

This commit is contained in:
AdisakKanthawilang 2025-03-26 15:23:18 +07:00
parent 6104d2b415
commit 3036bb9e3d
2 changed files with 27 additions and 0 deletions

View file

@ -77,6 +77,7 @@ import { ProfileActposition } from "../entities/ProfileActposition";
import { ProfileDuty } from "../entities/ProfileDuty"; import { ProfileDuty } from "../entities/ProfileDuty";
import { ProfileAssessment } from "../entities/ProfileAssessment"; import { ProfileAssessment } from "../entities/ProfileAssessment";
import { ProfileAbility } from "../entities/ProfileAbility"; import { ProfileAbility } from "../entities/ProfileAbility";
import { PermissionProfile } from "../entities/PermissionProfile";
@Route("api/v1/org/profile") @Route("api/v1/org/profile")
@Tags("Profile") @Tags("Profile")
@ -122,6 +123,7 @@ export class ProfileController extends Controller {
private dutyRepository = AppDataSource.getRepository(ProfileDuty); private dutyRepository = AppDataSource.getRepository(ProfileDuty);
private profileAssessmentsRepository = AppDataSource.getRepository(ProfileAssessment); private profileAssessmentsRepository = AppDataSource.getRepository(ProfileAssessment);
private profileAbilityRepo = AppDataSource.getRepository(ProfileAbility); private profileAbilityRepo = AppDataSource.getRepository(ProfileAbility);
private permissionProflileRepository = AppDataSource.getRepository(PermissionProfile);
/** /**
* report * report
@ -7251,6 +7253,16 @@ export class ProfileController extends Controller {
}; };
}), }),
); );
const permissionProflile = await this.permissionProflileRepository.findOne({
relations : ["orgRootTree"],
where:{
profileId: id,
orgRootTree:{
orgRevisionId: orgRevisionPublish.id
}
}
});
const _profile: any = { const _profile: any = {
profileId: profile.id, profileId: profile.id,
prefix: profile.prefix, prefix: profile.prefix,
@ -7305,6 +7317,8 @@ export class ProfileController extends Controller {
? `${profile.profileEducations[0].degree ?? ""} ${profile.profileEducations[0].field ?? ""}` ? `${profile.profileEducations[0].degree ?? ""} ${profile.profileEducations[0].field ?? ""}`
: "-", : "-",
statusCheckEdit: profile.statusCheckEdit, statusCheckEdit: profile.statusCheckEdit,
isEdit: permissionProflile?.isEdit??false,
isCheck: permissionProflile?.isCheck??false,
}; };
if (_profile.child4Id != null) { if (_profile.child4Id != null) {

View file

@ -69,6 +69,7 @@ import axios from "axios";
import { Position } from "../entities/Position"; import { Position } from "../entities/Position";
import { EmployeePosition } from "../entities/EmployeePosition"; import { EmployeePosition } from "../entities/EmployeePosition";
import { deleteUser } from "../keycloak"; import { deleteUser } from "../keycloak";
import { PermissionProfile } from "../entities/PermissionProfile";
@Route("api/v1/org/profile-employee") @Route("api/v1/org/profile-employee")
@Tags("ProfileEmployee") @Tags("ProfileEmployee")
@Security("bearerAuth") @Security("bearerAuth")
@ -111,6 +112,7 @@ export class ProfileEmployeeController extends Controller {
private profileLeaveRepository = AppDataSource.getRepository(ProfileLeave); private profileLeaveRepository = AppDataSource.getRepository(ProfileLeave);
private positionRepository = AppDataSource.getRepository(Position); private positionRepository = AppDataSource.getRepository(Position);
private employeePositionRepository = AppDataSource.getRepository(EmployeePosition); private employeePositionRepository = AppDataSource.getRepository(EmployeePosition);
private permissionProflileRepository = AppDataSource.getRepository(PermissionProfile);
/** /**
* report * report
@ -4704,6 +4706,15 @@ export class ProfileEmployeeController extends Controller {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง");
} }
const permissionProflile = await this.permissionProflileRepository.findOne({
relations : ["orgRootTree"],
where:{
profileId: id,
orgRootTree:{
orgRevisionId: orgRevisionPublish.id
}
}
});
const posMaster = const posMaster =
profile.current_holders == null || profile.current_holders == null ||
profile.current_holders.length == 0 || profile.current_holders.length == 0 ||
@ -4814,6 +4825,8 @@ export class ProfileEmployeeController extends Controller {
? `${profile.profileEducations[0].degree ?? ""} ${profile.profileEducations[0].field ?? ""}` ? `${profile.profileEducations[0].degree ?? ""} ${profile.profileEducations[0].field ?? ""}`
: "-", : "-",
statusCheckEdit: profile.statusCheckEdit, statusCheckEdit: profile.statusCheckEdit,
isEdit: permissionProflile?.isEdit??false,
isCheck: permissionProflile?.isCheck??false,
}; };
if (_profile.child4Id != null) { if (_profile.child4Id != null) {