check workflow

This commit is contained in:
kittapath 2024-10-22 08:20:45 +07:00
parent 4c2188a363
commit 32b0aa325d
74 changed files with 529 additions and 285 deletions

View file

@ -139,7 +139,9 @@ export class ProfileEmployeeController extends Controller {
},
});
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profile.id);
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_EMP");
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profile.id);
let ImgUrl: any;
if (profile?.avatar != null && profile?.avatarName != null) {
// await new CallAPI()
@ -305,7 +307,9 @@ export class ProfileEmployeeController extends Controller {
where: { id: id },
});
if (profiles) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profiles.id);
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_EMP");
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profiles.id);
}
if (!profiles) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
let ImgUrl: any;
@ -1230,7 +1234,9 @@ export class ProfileEmployeeController extends Controller {
*/
@Get("{id}")
async detailProfile(@Path() id: string, @Request() req: RequestWithUser) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id);
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_EMP");
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id);
const profile: any = await this.profileRepo.findOne({
relations: {
posLevel: true,
@ -1585,7 +1591,7 @@ export class ProfileEmployeeController extends Controller {
@Get("history/{id}")
async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) {
// await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id);ไม่แน่ใจEMPปิดไว้ก่อน
//await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id); ไม่แน่ใจEMPปิดไว้ก่อน;
const profile = await this.profileHistoryRepo.find({
relations: {
posLevel: true,
@ -3210,7 +3216,9 @@ export class ProfileEmployeeController extends Controller {
*/
@Get("information/{profileEmployeeId}")
async getInformationById(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_EMP");
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const profileInformation = await this.profileRepo.findOne({
where: { id: profileEmployeeId },
});
@ -3241,7 +3249,9 @@ export class ProfileEmployeeController extends Controller {
*/
@Get("information/history/{profileEmployeeId}")
async getInformationHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_EMP");
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const profileInformation = await this.informationHistoryRepository.find({
where: { profileEmployeeId: profileEmployeeId },
order: {
@ -3263,7 +3273,9 @@ export class ProfileEmployeeController extends Controller {
@Path() profileEmployeeId: string,
@Request() req: RequestWithUser,
) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_EMP");
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const employment = await this.employmentRepository.find({
where: { profileEmployeeId: profileEmployeeId },
order: { createdAt: "ASC" },
@ -3289,11 +3301,13 @@ export class ProfileEmployeeController extends Controller {
where: { id: id },
});
if (employment) {
await new permission().PermissionOrgUserGet(
req,
"SYS_REGISTRY_EMP",
employment.profileEmployeeId,
);
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_EMP");
if (_workflow == false)
await new permission().PermissionOrgUserGet(
req,
"SYS_REGISTRY_EMP",
employment.profileEmployeeId,
);
}
return new HttpSuccess(employment);
}
@ -3311,11 +3325,13 @@ export class ProfileEmployeeController extends Controller {
where: { id: id },
});
if (employment) {
await new permission().PermissionOrgUserGet(
req,
"SYS_REGISTRY_EMP",
employment.profileEmployeeId,
);
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_EMP");
if (_workflow == false)
await new permission().PermissionOrgUserGet(
req,
"SYS_REGISTRY_EMP",
employment.profileEmployeeId,
);
}
const employmentHistory = await this.employmentHistoryRepository.find({
where: { profileEmployeeEmploymentId: id },
@ -3705,17 +3721,23 @@ export class ProfileEmployeeController extends Controller {
async getProfileByProfileid(@Request() request: RequestWithUser, @Path() id: string) {
const profile = await this.profileRepo.findOne({
where: { id: id },
relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot", "profileSalarys"],
relations: [
"posLevel",
"posType",
"current_holders",
"current_holders.orgRoot",
"profileSalarys",
],
order: {
profileSalarys: {
order: "DESC"
}
}
order: "DESC",
},
},
});
if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
}
// await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_EMP", profile.id);//ไม่แน่ใจEMPปิดไว้ก่อน
//await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_EMP", profile.id); //ไม่แน่ใจEMPปิดไว้ก่อน
const orgRevisionPublish = await this.orgRevisionRepo
.createQueryBuilder("orgRevision")
@ -3831,7 +3853,8 @@ export class ProfileEmployeeController extends Controller {
node: null,
nodeId: null,
posNo: shortName,
salary: profile && profile.profileSalarys.length > 0 ? profile.profileSalarys[0].amount : null
salary:
profile && profile.profileSalarys.length > 0 ? profile.profileSalarys[0].amount : null,
};
if (_profile.child4Id != null) {