Merge branch 'develop' into adiDev
This commit is contained in:
commit
66cce71f1d
79 changed files with 673 additions and 294 deletions
|
|
@ -2096,6 +2096,9 @@ export class CommandController extends Controller {
|
|||
refCommandNo?: string | null;
|
||||
salaryRef?: string | null;
|
||||
commandId?: string | null;
|
||||
amount?: Double | null;
|
||||
positionSalaryAmount?: Double | null;
|
||||
mouthSalaryAmount?: Double | null;
|
||||
}[];
|
||||
},
|
||||
) {
|
||||
|
|
@ -2133,11 +2136,9 @@ export class CommandController extends Controller {
|
|||
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
|
||||
positionExecutive:
|
||||
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
|
||||
amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
|
||||
positionSalaryAmount:
|
||||
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
|
||||
mouthSalaryAmount:
|
||||
profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
|
||||
amount: item.amount ? item.amount : null,
|
||||
positionSalaryAmount: item.positionSalaryAmount ? item.positionSalaryAmount : null,
|
||||
mouthSalaryAmount: item.mouthSalaryAmount ? item.mouthSalaryAmount : null,
|
||||
order:
|
||||
profile.profileSalary.length >= 0
|
||||
? profile.profileSalary.length > 0
|
||||
|
|
@ -2176,6 +2177,9 @@ export class CommandController extends Controller {
|
|||
refCommandNo?: string | null;
|
||||
salaryRef?: string | null;
|
||||
commandId?: string | null;
|
||||
amount?: Double | null;
|
||||
positionSalaryAmount?: Double | null;
|
||||
mouthSalaryAmount?: Double | null;
|
||||
}[];
|
||||
},
|
||||
) {
|
||||
|
|
@ -2226,11 +2230,9 @@ export class CommandController extends Controller {
|
|||
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
|
||||
positionExecutive:
|
||||
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
|
||||
amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
|
||||
positionSalaryAmount:
|
||||
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
|
||||
mouthSalaryAmount:
|
||||
profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
|
||||
amount: item.amount ? item.amount : null,
|
||||
positionSalaryAmount: item.positionSalaryAmount ? item.positionSalaryAmount : null,
|
||||
mouthSalaryAmount: item.mouthSalaryAmount ? item.mouthSalaryAmount : null,
|
||||
order:
|
||||
profile.profileSalary.length >= 0
|
||||
? profile.profileSalary.length > 0
|
||||
|
|
|
|||
|
|
@ -174,7 +174,8 @@ export class DevelopmentRequestController extends Controller {
|
|||
|
||||
@Get("admin/{id}")
|
||||
public async getDevelopmentRequestByUser(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_OFFICER");
|
||||
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_OFFICER");
|
||||
const data = await this.developmentRequestRepository.findOne({
|
||||
where: { id: id },
|
||||
relations: ["developmentProjects"],
|
||||
|
|
@ -301,7 +302,7 @@ export class DevelopmentRequestController extends Controller {
|
|||
});
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
|
||||
|
||||
if (requestBody.status == "APPROVE" && record.status == "PENDING") {
|
||||
let profileDevelopment = new ProfileDevelopment();
|
||||
const meta = {
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ export class OrgRootController extends Controller {
|
|||
orgRootPhoneIn: orgRoot.orgRootPhoneIn,
|
||||
orgRootFax: orgRoot.orgRootFax,
|
||||
orgRevisionId: orgRoot.orgRevisionId,
|
||||
isDeputy: orgRoot.isDeputy,
|
||||
orgCode: orgRoot.orgRootCode + "00",
|
||||
};
|
||||
return new HttpSuccess(getOrgRoot);
|
||||
|
|
@ -102,6 +103,24 @@ export class OrgRootController extends Controller {
|
|||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionCreate(request, "SYS_ORG");
|
||||
|
||||
if (requestBody.isDeputy == true) {
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
where: { id: requestBody.orgRevisionId },
|
||||
relations: ["orgRoots"],
|
||||
});
|
||||
if (orgRevision != null) {
|
||||
await Promise.all(
|
||||
orgRevision.orgRoots
|
||||
.filter((x: OrgRoot) => x.isDeputy == true)
|
||||
.map(async (item: OrgRoot) => {
|
||||
item.isDeputy = false;
|
||||
await this.orgRootRepository.save(item);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const validOrgRootRanks = ["DEPARTMENT", "OFFICE", "DIVISION", "SECTION"];
|
||||
if (!validOrgRootRanks.includes(requestBody.orgRootRank.toUpperCase())) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. orgRootRank");
|
||||
|
|
@ -193,6 +212,23 @@ export class OrgRootController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. orgRo otRank");
|
||||
}
|
||||
|
||||
if (requestBody.isDeputy == true) {
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
where: { id: requestBody.orgRevisionId },
|
||||
relations: ["orgRoots"],
|
||||
});
|
||||
if (orgRevision != null) {
|
||||
await Promise.all(
|
||||
orgRevision.orgRoots
|
||||
.filter((x: OrgRoot) => x.isDeputy == true)
|
||||
.map(async (item: OrgRoot) => {
|
||||
item.isDeputy = false;
|
||||
await this.orgRootRepository.save(item);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const revisionIdExits = await this.orgRevisionRepository.findOne({
|
||||
where: { id: requestBody.orgRevisionId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -732,6 +732,7 @@ export class OrganizationController extends Controller {
|
|||
// )
|
||||
.select([
|
||||
"orgRoot.id",
|
||||
"orgRoot.isDeputy",
|
||||
"orgRoot.orgRootName",
|
||||
"orgRoot.orgRootShortName",
|
||||
"orgRoot.orgRootCode",
|
||||
|
|
@ -906,6 +907,7 @@ export class OrganizationController extends Controller {
|
|||
orgRootName: orgRoot.orgRootName,
|
||||
responsibility: orgRoot.responsibility,
|
||||
isOfficer: false,
|
||||
isDeputy: orgRoot.isDeputy,
|
||||
labelName:
|
||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
||||
totalPosition: await this.posMasterRepository.count({
|
||||
|
|
@ -1552,6 +1554,7 @@ export class OrganizationController extends Controller {
|
|||
})
|
||||
.select([
|
||||
"orgRoot.id",
|
||||
"orgRoot.isDeputy",
|
||||
"orgRoot.orgRootName",
|
||||
"orgRoot.orgRootShortName",
|
||||
"orgRoot.orgRootCode",
|
||||
|
|
@ -1685,6 +1688,7 @@ export class OrganizationController extends Controller {
|
|||
orgTreeFax: orgRoot.orgRootFax,
|
||||
orgRevisionId: orgRoot.orgRevisionId,
|
||||
orgRootName: orgRoot.orgRootName,
|
||||
isDeputy: orgRoot.isDeputy,
|
||||
responsibility: orgRoot.responsibility,
|
||||
labelName:
|
||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
||||
|
|
@ -2322,6 +2326,7 @@ export class OrganizationController extends Controller {
|
|||
)
|
||||
.select([
|
||||
"orgRoot.id",
|
||||
"orgRoot.isDeputy",
|
||||
"orgRoot.orgRootName",
|
||||
"orgRoot.orgRootShortName",
|
||||
"orgRoot.orgRootCode",
|
||||
|
|
@ -2495,6 +2500,7 @@ export class OrganizationController extends Controller {
|
|||
orgTreeFax: orgRoot.orgRootFax,
|
||||
orgRevisionId: orgRoot.orgRevisionId,
|
||||
orgRootName: orgRoot.orgRootName,
|
||||
isDeputy:orgRoot.isDeputy,
|
||||
responsibility: orgRoot.responsibility,
|
||||
labelName:
|
||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
||||
|
|
@ -6561,6 +6567,24 @@ export class OrganizationController extends Controller {
|
|||
const check = orgRevision.orgChild1s.find((x) => x.isOfficer == true);
|
||||
return new HttpSuccess(check != null);
|
||||
}
|
||||
/**
|
||||
* API เช็ค org ในระบบ
|
||||
*
|
||||
* @summary - เช็ค org ในระบบ (ADMIN)
|
||||
*
|
||||
*/
|
||||
@Get("check/root/{id}")
|
||||
async findIsDeputyRoot(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
where: { id },
|
||||
relations: ["orgRoots"],
|
||||
});
|
||||
if (!orgRevision) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
const check = orgRevision.orgRoots.find((x) => x.isDeputy == true);
|
||||
return new HttpSuccess(check != null);
|
||||
}
|
||||
public async listAuthSysOrgFuncByRevisionIdN(
|
||||
request: RequestWithUser,
|
||||
system: string,
|
||||
|
|
|
|||
|
|
@ -2152,7 +2152,8 @@ export class PositionController extends Controller {
|
|||
*/
|
||||
@Get("history/{id}")
|
||||
async getHistoryPosMater(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionGet(request, "SYS_ORG");
|
||||
let _workflow = await new permission().Workflow(request, id, "SYS_ORG");
|
||||
if (_workflow == false) await new permission().PermissionGet(request, "SYS_ORG");
|
||||
const posMaster = await this.posMasterRepository.findOne({
|
||||
where: { id },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -51,7 +51,9 @@ export class ProfileAbilityController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async detailProfileAbility(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const getProfileAbilityId = await this.profileAbilityRepo.find({
|
||||
where: { profileId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -69,7 +71,9 @@ export class ProfileAbilityController extends Controller {
|
|||
) {
|
||||
const _record = await this.profileAbilityRepo.findOneBy({ id: abilityId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
let _workflow = await new permission().Workflow(req, abilityId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
}
|
||||
|
||||
const record = await this.profileAbilityHistoryRepo.find({
|
||||
|
|
|
|||
|
|
@ -54,7 +54,9 @@ export class ProfileAbilityEmployeeController 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 getProfileAbilityId = await this.profileAbilityRepo.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -72,11 +74,13 @@ export class ProfileAbilityEmployeeController extends Controller {
|
|||
) {
|
||||
const _record = await this.profileAbilityRepo.findOneBy({ id: abilityId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
let _workflow = await new permission().Workflow(req, abilityId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
const record = await this.profileAbilityHistoryRepo.find({
|
||||
where: { profileAbilityId: abilityId },
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ export class ProfileAbilityEmployeeTempController extends Controller {
|
|||
@Path() profileEmployeeId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const getProfileAbilityId = await this.profileAbilityRepo.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -72,7 +73,8 @@ export class ProfileAbilityEmployeeTempController extends Controller {
|
|||
) {
|
||||
const _record = await this.profileAbilityRepo.findOneBy({ id: abilityId });
|
||||
if (_record) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, abilityId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
}
|
||||
const record = await this.profileAbilityHistoryRepo.find({
|
||||
where: { profileAbilityId: abilityId },
|
||||
|
|
|
|||
|
|
@ -51,7 +51,9 @@ export class ProfileAddressController extends Controller {
|
|||
*/
|
||||
@Get("{profileId}")
|
||||
public async detailProfileAddress(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const getProfileAddress = await this.profileRepo.findOne({
|
||||
where: { id: profileId },
|
||||
select: [
|
||||
|
|
@ -125,7 +127,9 @@ export class ProfileAddressController extends Controller {
|
|||
@Path() profileId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const record = await this.profileAddressHistoryRepo.find({
|
||||
where: { profileId: profileId },
|
||||
relations: [
|
||||
|
|
|
|||
|
|
@ -55,7 +55,9 @@ export class ProfileAddressEmployeeController 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 getProfileAddress = await this.profileEmployeeRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
select: [
|
||||
|
|
@ -129,7 +131,9 @@ export class ProfileAddressEmployeeController extends Controller {
|
|||
@Path() profileId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
|
||||
const record = await this.profileAddressHistoryRepo.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
relations: [
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ export class ProfileAddressEmployeeTempController extends Controller {
|
|||
@Path() profileEmployeeId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const getProfileAddress = await this.profileEmployeeRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
select: [
|
||||
|
|
@ -129,7 +130,8 @@ export class ProfileAddressEmployeeTempController extends Controller {
|
|||
@Path() profileId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.profileAddressHistoryRepo.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
relations: [
|
||||
|
|
|
|||
|
|
@ -55,7 +55,9 @@ export class ProfileAssessmentsController extends Controller {
|
|||
@Path() profileId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const getProfileAssessments = await this.profileAssessmentsRepository.find({
|
||||
where: { profileId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -77,7 +79,9 @@ export class ProfileAssessmentsController extends Controller {
|
|||
},
|
||||
});
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
let _workflow = await new permission().Workflow(req, assessmentId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
}
|
||||
|
||||
const record = await this.profileAssessmentsHistoryRepository.find({
|
||||
|
|
|
|||
|
|
@ -55,7 +55,9 @@ export class ProfileAssessmentsEmployeeController 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 getProfileAssessments = await this.profileAssessmentsRepository.find({
|
||||
where: {
|
||||
profileEmployeeId: profileEmployeeId,
|
||||
|
|
@ -75,11 +77,13 @@ export class ProfileAssessmentsEmployeeController extends Controller {
|
|||
) {
|
||||
const _record = await this.profileAssessmentsRepository.findOneBy({ id: assessmentId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
let _workflow = await new permission().Workflow(req, assessmentId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
const record = await this.profileAssessmentsHistoryRepository.find({
|
||||
where: {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ export class ProfileAssessmentsEmployeeTempController extends Controller {
|
|||
@Path() profileEmployeeId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const getProfileAssessments = await this.profileAssessmentsRepository.find({
|
||||
where: {
|
||||
profileEmployeeId: profileEmployeeId,
|
||||
|
|
@ -73,7 +74,8 @@ export class ProfileAssessmentsEmployeeTempController extends Controller {
|
|||
@Path() assessmentId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, assessmentId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.profileAssessmentsHistoryRepository.find({
|
||||
where: {
|
||||
profileAssessmentId: assessmentId,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@ export class ProfileAvatarController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getAvatar(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const lists = await this.avatarRepository.find({
|
||||
where: { profileId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -27,7 +29,9 @@ export class ProfileAvatarController extends Controller {
|
|||
|
||||
@Get("profileId/{id}")
|
||||
async getProfile(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", id);
|
||||
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", id);
|
||||
const profile = await this.profileRepository.findOne({
|
||||
where: { id },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -20,7 +20,9 @@ export class ProfileAvatarEmployeeController 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 lists = await this.avatarRepository.find({
|
||||
where: { profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -30,7 +32,9 @@ export class ProfileAvatarEmployeeController extends Controller {
|
|||
|
||||
@Get("profileEmployeeId/{id}")
|
||||
async getProfile(@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 = await this.profileRepository.findOne({
|
||||
where: { id },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ export class ProfileAvatarEmployeeTempController extends Controller {
|
|||
@Path() profileEmployeeId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const lists = await this.avatarRepository.find({
|
||||
where: { profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -30,7 +31,8 @@ export class ProfileAvatarEmployeeTempController extends Controller {
|
|||
|
||||
@Get("profileEmployeeId/{id}")
|
||||
async getProfile(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepository.findOne({
|
||||
where: { id },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -48,7 +48,9 @@ export class ProfileCertificateController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getCertificate(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const record = await this.certificateRepo.find({
|
||||
where: { profileId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -63,7 +65,9 @@ export class ProfileCertificateController extends Controller {
|
|||
) {
|
||||
const _record = await this.certificateRepo.findOneBy({ id: certificateId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
let _workflow = await new permission().Workflow(req, certificateId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
}
|
||||
const record = await this.certificateHistoryRepo.find({
|
||||
where: {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,9 @@ export class ProfileCertificateEmployeeController extends Controller {
|
|||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getCertificate(@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 record = await this.certificateRepo.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -63,11 +65,13 @@ export class ProfileCertificateEmployeeController extends Controller {
|
|||
) {
|
||||
const _record = await this.certificateRepo.findOneBy({ id: certificateId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
let _workflow = await new permission().Workflow(req, certificateId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
const record = await this.certificateHistoryRepo.find({
|
||||
where: {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ export class ProfileCertificateEmployeeTempController extends Controller {
|
|||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getCertificate(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.certificateRepo.find({
|
||||
where: { profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -61,7 +62,8 @@ export class ProfileCertificateEmployeeTempController extends Controller {
|
|||
@Path() certificateId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, certificateId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.certificateHistoryRepo.find({
|
||||
where: {
|
||||
profileCertificateId: certificateId,
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@ export class ProfileChangeNameController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getChangeName(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const lists = await this.changeNameRepository.find({
|
||||
where: { profileId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -61,7 +63,9 @@ export class ProfileChangeNameController extends Controller {
|
|||
public async changeNameHistory(@Path() changeNameId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.changeNameRepository.findOneBy({ id: changeNameId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
let _workflow = await new permission().Workflow(req, changeNameId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
}
|
||||
const record = await this.changeNameHistoryRepository.find({
|
||||
where: { profileChangeNameId: changeNameId },
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@ export class ProfileChangeNameEmployeeController extends Controller {
|
|||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getChangeName(@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 lists = await this.changeNameRepository.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -61,11 +63,13 @@ export class ProfileChangeNameEmployeeController extends Controller {
|
|||
public async changeNameHistory(@Path() changeNameId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.changeNameRepository.findOneBy({ id: changeNameId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
let _workflow = await new permission().Workflow(req, changeNameId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
const record = await this.changeNameHistoryRepository.find({
|
||||
where: { profileChangeNameId: changeNameId },
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ export class ProfileChangeNameEmployeeTempController extends Controller {
|
|||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getChangeName(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const lists = await this.changeNameRepository.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -59,7 +60,8 @@ export class ProfileChangeNameEmployeeTempController extends Controller {
|
|||
|
||||
@Get("history/{changeNameId}")
|
||||
public async changeNameHistory(@Path() changeNameId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, changeNameId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.changeNameHistoryRepository.find({
|
||||
where: { profileChangeNameId: changeNameId },
|
||||
order: { createdAt: "DESC" },
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@ export class ProfileChildrenController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getChildren(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const lists = await this.childrenRepository.find({
|
||||
where: { profileId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -61,7 +63,9 @@ export class ProfileChildrenController extends Controller {
|
|||
public async childrenHistory(@Path() childrenId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.childrenRepository.findOneBy({ id: childrenId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
let _workflow = await new permission().Workflow(req, childrenId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
}
|
||||
const record = await this.childrenHistoryRepository.find({
|
||||
where: { profileChildrenId: childrenId },
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@ export class ProfileChildrenEmployeeController extends Controller {
|
|||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getChildren(@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 lists = await this.childrenRepository.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -61,11 +63,13 @@ export class ProfileChildrenEmployeeController extends Controller {
|
|||
public async childrenHistory(@Path() childrenId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.childrenRepository.findOneBy({ id: childrenId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
let _workflow = await new permission().Workflow(req, childrenId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
const record = await this.childrenHistoryRepository.find({
|
||||
where: { profileChildrenId: childrenId },
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ export class ProfileChildrenEmployeeTempController extends Controller {
|
|||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getChildren(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const lists = await this.childrenRepository.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -59,7 +60,8 @@ export class ProfileChildrenEmployeeTempController extends Controller {
|
|||
|
||||
@Get("history/{childrenId}")
|
||||
public async childrenHistory(@Path() childrenId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, childrenId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.childrenHistoryRepository.find({
|
||||
where: { profileChildrenId: childrenId },
|
||||
order: { createdAt: "DESC" },
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ export class ProfileController extends Controller {
|
|||
*/
|
||||
@Get("kp7-short/{id}")
|
||||
async kp7ShortById(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", id);
|
||||
//await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", id);
|
||||
const orgRevision = await this.orgRevisionRepo.findOne({
|
||||
where: { orgRevisionIsCurrent: true },
|
||||
});
|
||||
|
|
@ -283,7 +283,7 @@ export class ProfileController extends Controller {
|
|||
*/
|
||||
@Get("kk1/{id}")
|
||||
public async getKk1(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", id);
|
||||
//await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", id);
|
||||
const profiles = await this.profileRepo.findOne({
|
||||
// select: [
|
||||
// "citizenId",
|
||||
|
|
@ -1234,7 +1234,7 @@ export class ProfileController extends Controller {
|
|||
*/
|
||||
@Get("commander/{profileId}")
|
||||
async getProfileCommanderUser(@Request() request: RequestWithUser, @Path() profileId: string) {
|
||||
// await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_OFFICER", profileId);//ไม่แน่ใจOFFปิดไว้ก่อน
|
||||
//await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_OFFICER", profileId); //ไม่แน่ใจOFFปิดไว้ก่อน
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileId },
|
||||
});
|
||||
|
|
@ -2752,7 +2752,9 @@ export class ProfileController extends Controller {
|
|||
*/
|
||||
@Get("{id}")
|
||||
async getProfile(@Request() req: RequestWithUser, @Path() id: string) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", id);
|
||||
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", id);
|
||||
let profile: any = await this.profileRepo.findOne({
|
||||
relations: {
|
||||
posLevel: true,
|
||||
|
|
@ -2798,7 +2800,7 @@ export class ProfileController extends Controller {
|
|||
|
||||
@Get("history/{id}")
|
||||
async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", id);//ไม่แน่ใจOFFปิดไว้ก่อน
|
||||
//await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", id); //ไม่แน่ใจOFFปิดไว้ก่อน
|
||||
const profile = await this.profileHistoryRepo.find({
|
||||
relations: {
|
||||
posLevel: true,
|
||||
|
|
@ -3975,7 +3977,7 @@ export class ProfileController extends Controller {
|
|||
*/
|
||||
@Get("profileid/position/{id}")
|
||||
async getProfileByProfileid(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
// await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_OFFICER", id);//ไม่แน่ใจOFFปิดไว้ก่อน
|
||||
//await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_OFFICER", id); //ไม่แน่ใจOFFปิดไว้ก่อน
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: id },
|
||||
relations: [
|
||||
|
|
@ -4208,7 +4210,7 @@ export class ProfileController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
|
||||
}
|
||||
// await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_OFFICER", profile.id);//ไม่แน่ใจOFFปิดไว้ก่อน
|
||||
//await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFFปิดไว้ก่อน
|
||||
return new HttpSuccess(profile);
|
||||
}
|
||||
|
||||
|
|
@ -4228,7 +4230,7 @@ export class ProfileController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
|
||||
}
|
||||
// await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_OFFICER", profile.id);//ไม่แน่ใจOFFปิดไว้ก่อน
|
||||
//await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFFปิดไว้ก่อน
|
||||
|
||||
const orgRevisionPublish = await this.orgRevisionRepo
|
||||
.createQueryBuilder("orgRevision")
|
||||
|
|
@ -4343,7 +4345,7 @@ export class ProfileController extends Controller {
|
|||
*/
|
||||
@Get("profileempid/position/{id}")
|
||||
async getProfileByProfileempid(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
// await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_OFFICER", id);//ไม่แน่ใจOFFปิดไว้ก่อน
|
||||
//await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_OFFICER", id); //ไม่แน่ใจOFFปิดไว้ก่อน
|
||||
const profile = await this.profileEmpRepo.findOne({
|
||||
where: { id: id },
|
||||
relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"],
|
||||
|
|
@ -5671,7 +5673,7 @@ export class ProfileController extends Controller {
|
|||
*/
|
||||
@Get("profileid/retire/{year}")
|
||||
async getProfileByRetireYear(@Path() year: number, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", id);//ไม่แน่ใจOFFปิดไว้ก่อน
|
||||
//await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", id); //ไม่แน่ใจOFFปิดไว้ก่อน
|
||||
const profiles = await this.profileRepo
|
||||
.createQueryBuilder("profile")
|
||||
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||
|
|
@ -6363,15 +6365,16 @@ export class ProfileController extends Controller {
|
|||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* API แก้ไขเบอร์โทรศัพท์
|
||||
*
|
||||
* @summary แก้ไขเบอร์โทรศัพท์ (USER)
|
||||
* @summary แก้ไขเบอร์โทรศัพท์ (USER)
|
||||
*
|
||||
*/
|
||||
@Put("updatePhoneNumber/user")
|
||||
async updatePhoneNumber(@Request() request: RequestWithUser,
|
||||
@Body()
|
||||
async updatePhoneNumber(
|
||||
@Request() request: RequestWithUser,
|
||||
@Body()
|
||||
body: {
|
||||
phone: string;
|
||||
},
|
||||
|
|
@ -6408,15 +6411,16 @@ export class ProfileController extends Controller {
|
|||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* API แก้ไขอีเมล
|
||||
*
|
||||
* @summary แก้ไขอีเมล (USER)
|
||||
* @summary แก้ไขอีเมล (USER)
|
||||
*
|
||||
*/
|
||||
@Put("updateEmail/user")
|
||||
async updateEmail(@Request() request: RequestWithUser,
|
||||
@Body()
|
||||
async updateEmail(
|
||||
@Request() request: RequestWithUser,
|
||||
@Body()
|
||||
body: {
|
||||
email: string;
|
||||
},
|
||||
|
|
@ -6453,7 +6457,4 @@ export class ProfileController extends Controller {
|
|||
]);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
Query
|
||||
Query,
|
||||
} from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
|
|
@ -51,13 +51,15 @@ export class ProfileDevelopmentController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getDevelopment(
|
||||
@Path() profileId: string,
|
||||
@Path() profileId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
@Query() searchKeyword: string = "",
|
||||
) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const [profileDevelopment, total] = await AppDataSource.getRepository(ProfileDevelopment)
|
||||
.createQueryBuilder("profileDevelopment")
|
||||
.where({ profileId: profileId })
|
||||
|
|
@ -67,10 +69,10 @@ export class ProfileDevelopmentController extends Controller {
|
|||
searchKeyword != undefined && searchKeyword != null && searchKeyword != ""
|
||||
? "profileDevelopment.name LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${searchKeyword}%`,
|
||||
},
|
||||
)
|
||||
{
|
||||
keyword: `%${searchKeyword}%`,
|
||||
},
|
||||
)
|
||||
.orWhere(
|
||||
searchKeyword != undefined && searchKeyword != null && searchKeyword != ""
|
||||
? "profileDevelopment.developmentTarget LIKE :keyword"
|
||||
|
|
@ -108,7 +110,9 @@ export class ProfileDevelopmentController extends Controller {
|
|||
public async developmentHistory(@Path() developmentId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.developmentRepository.findOneBy({ id: developmentId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
let _workflow = await new permission().Workflow(req, developmentId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
}
|
||||
const record = await this.developmentHistoryRepository.find({
|
||||
where: { profileDevelopmentId: developmentId },
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@ export class ProfileDevelopmentEmployeeController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getDevelopment(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
|
||||
const lists = await this.developmentRepository.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -61,11 +63,13 @@ export class ProfileDevelopmentEmployeeController extends Controller {
|
|||
public async developmentHistory(@Path() developmentId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.developmentRepository.findOneBy({ id: developmentId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
let _workflow = await new permission().Workflow(req, developmentId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
const record = await this.developmentHistoryRepository.find({
|
||||
where: { profileDevelopmentId: developmentId },
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ export class ProfileDevelopmentEmployeeTempController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getDevelopment(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const lists = await this.developmentRepository.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -59,7 +60,8 @@ export class ProfileDevelopmentEmployeeTempController extends Controller {
|
|||
|
||||
@Get("history/{developmentId}")
|
||||
public async developmentHistory(@Path() developmentId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, developmentId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.developmentHistoryRepository.find({
|
||||
where: { profileDevelopmentId: developmentId },
|
||||
order: { createdAt: "DESC" },
|
||||
|
|
|
|||
|
|
@ -48,7 +48,9 @@ export class ProfileDisciplineController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getDiscipline(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const lists = await this.disciplineRepository.find({
|
||||
where: { profileId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -58,7 +60,8 @@ export class ProfileDisciplineController extends Controller {
|
|||
|
||||
@Get("admin/{profileId}")
|
||||
public async getDisciplineAdmin(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_SALARY_OFFICER");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_SALARY_OFFICER");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_SALARY_OFFICER");
|
||||
const lists = await this.disciplineRepository.find({
|
||||
where: { profileId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -73,7 +76,9 @@ export class ProfileDisciplineController extends Controller {
|
|||
) {
|
||||
const _record = await this.disciplineRepository.findOneBy({ id: disciplineId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
let _workflow = await new permission().Workflow(req, disciplineId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
}
|
||||
const record = await this.disciplineHistoryRepository.find({
|
||||
where: { profileDisciplineId: disciplineId },
|
||||
|
|
|
|||
|
|
@ -48,7 +48,9 @@ export class ProfileDisciplineEmployeeController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getDiscipline(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
|
||||
const lists = await this.disciplineRepository.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -58,7 +60,8 @@ export class ProfileDisciplineEmployeeController extends Controller {
|
|||
|
||||
@Get("admin/{profileId}")
|
||||
public async getDisciplineAdmin(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_WAGE");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_WAGE");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_WAGE");
|
||||
const lists = await this.disciplineRepository.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -73,11 +76,13 @@ export class ProfileDisciplineEmployeeController extends Controller {
|
|||
) {
|
||||
const _record = await this.disciplineRepository.findOneBy({ id: disciplineId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
let _workflow = await new permission().Workflow(req, disciplineId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
const record = await this.disciplineHistoryRepository.find({
|
||||
where: { profileDisciplineId: disciplineId },
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ export class ProfileDisciplineEmployeeTempController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getDiscipline(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const lists = await this.disciplineRepository.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -58,7 +59,8 @@ export class ProfileDisciplineEmployeeTempController extends Controller {
|
|||
|
||||
@Get("admin/{profileId}")
|
||||
public async getDisciplineAdmin(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_WAGE");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_WAGE");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_WAGE");
|
||||
const lists = await this.disciplineRepository.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -71,7 +73,8 @@ export class ProfileDisciplineEmployeeTempController extends Controller {
|
|||
@Path() disciplineId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, disciplineId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.disciplineHistoryRepository.find({
|
||||
where: { profileDisciplineId: disciplineId },
|
||||
order: { createdAt: "DESC" },
|
||||
|
|
|
|||
|
|
@ -44,7 +44,9 @@ export class ProfileDutyController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getDuty(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const lists = await this.dutyRepository.find({
|
||||
where: { profileId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -56,7 +58,9 @@ export class ProfileDutyController extends Controller {
|
|||
public async dutyAdminHistory(@Path() dutyId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.dutyRepository.findOneBy({ id: dutyId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
let _workflow = await new permission().Workflow(req, dutyId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
}
|
||||
const record = await this.dutyHistoryRepository.find({
|
||||
where: { profileDutyId: dutyId },
|
||||
|
|
|
|||
|
|
@ -44,7 +44,9 @@ export class ProfileDutyEmployeeController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getDuty(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
|
||||
const lists = await this.dutyRepository.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -56,11 +58,13 @@ export class ProfileDutyEmployeeController extends Controller {
|
|||
public async dutyAdminHistory(@Path() dutyId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.dutyRepository.findOneBy({ id: dutyId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
let _workflow = await new permission().Workflow(req, dutyId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
const record = await this.dutyHistoryRepository.find({
|
||||
where: { profileDutyId: dutyId },
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ export class ProfileDutyEmployeeTempController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getDuty(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const lists = await this.dutyRepository.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -54,7 +55,8 @@ export class ProfileDutyEmployeeTempController extends Controller {
|
|||
|
||||
@Get("admin/history/{dutyId}")
|
||||
public async dutyAdminHistory(@Path() dutyId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, dutyId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.dutyHistoryRepository.find({
|
||||
where: { profileDutyId: dutyId },
|
||||
order: { createdAt: "DESC" },
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ export class ProfileEditController extends Controller {
|
|||
await new CallAPI()
|
||||
.PostData(req, "/org/workflow/add-workflow", {
|
||||
refId: data.id,
|
||||
sysName: "REGISTRY_PROFILE",
|
||||
sysName: "SYS_REGISTRY_OFFICER",
|
||||
posLevelName: profile.posLevel.posLevelName,
|
||||
posTypeName: profile.posType.posTypeName,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -53,7 +53,9 @@ export class ProfileEducationsController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async detailProfileEducation(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const getProfileEducation = await this.profileEducationRepo.find({
|
||||
where: { profileId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -71,7 +73,9 @@ export class ProfileEducationsController extends Controller {
|
|||
) {
|
||||
const _record = await this.profileEducationRepo.findOneBy({ id: educationId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
let _workflow = await new permission().Workflow(req, educationId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
}
|
||||
const record = await this.profileEducationHistoryRepo.find({
|
||||
where: {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,9 @@ export class ProfileEducationsEmployeeController 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 getProfileEducation = await this.profileEducationRepo.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -72,11 +74,13 @@ export class ProfileEducationsEmployeeController extends Controller {
|
|||
) {
|
||||
const _record = await this.profileEducationRepo.findOneBy({ id: educationId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
let _workflow = await new permission().Workflow(req, educationId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
|
||||
const record = await this.profileEducationHistoryRepo.find({
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ export class ProfileEducationsEmployeeTempController extends Controller {
|
|||
@Path() profileEmployeeId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const getProfileEducation = await this.profileEducationRepo.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -70,7 +71,8 @@ export class ProfileEducationsEmployeeTempController extends Controller {
|
|||
@Path() educationId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, educationId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.profileEducationHistoryRepo.find({
|
||||
where: {
|
||||
profileEducationId: educationId,
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -115,7 +115,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*/
|
||||
@Get("kp7-short/{id}")
|
||||
async kp7ShortById(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const orgRevision = await this.orgRevisionRepo.findOne({
|
||||
where: { orgRevisionIsCurrent: true },
|
||||
});
|
||||
|
|
@ -239,7 +240,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*/
|
||||
@Get("kk1/{id}")
|
||||
public async getKk1Employee(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profiles = await this.profileRepo.findOne({
|
||||
// select: [
|
||||
// "citizenId",
|
||||
|
|
@ -1055,7 +1057,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*/
|
||||
@Get("{id}")
|
||||
async detailProfile(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepo.findOne({
|
||||
relations: {
|
||||
posLevel: true,
|
||||
|
|
@ -2941,7 +2944,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*/
|
||||
@Get("information/{profileEmployeeId}")
|
||||
async getInformationById(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profileInformation = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -2972,7 +2976,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*/
|
||||
@Get("information/history/{profileEmployeeId}")
|
||||
async getInformationHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profileInformation = await this.informationHistoryRepository.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: {
|
||||
|
|
@ -2994,7 +2999,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
@Path() profileEmployeeId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const employment = await this.employmentRepository.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -3016,7 +3022,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*/
|
||||
@Get("employment/id/{id}")
|
||||
async GetEmploymentById(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const employment = await this.employmentRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -3032,7 +3039,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*/
|
||||
@Get("employment/history/{id}")
|
||||
async GetHistoryEmploymentById(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const employmentHistory = await this.employmentHistoryRepository.find({
|
||||
where: { profileEmployeeEmploymentId: id },
|
||||
order: { lastUpdatedAt: "ASC" },
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ export class ProfileFamilyCoupleController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getFamilyCouple(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileId },
|
||||
});
|
||||
|
|
@ -113,7 +115,9 @@ export class ProfileFamilyCoupleController extends Controller {
|
|||
|
||||
@Get("history/{profileId}")
|
||||
public async familyCoupleHistory(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -44,7 +44,9 @@ export class ProfileFamilyCoupleEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
const familyCouple = await this.ProfileFamilyCouple.findOne({
|
||||
where: { profileEmployeeId },
|
||||
|
|
@ -110,7 +112,9 @@ export class ProfileFamilyCoupleEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
const familyCouple = await this.ProfileFamilyCouple.find({
|
||||
relations: ["histories"],
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller {
|
|||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getFamilyCouple(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -105,7 +106,8 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller {
|
|||
@Path() profileEmployeeId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ export class ProfileFamilyFatherController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getFamilyFather(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileId },
|
||||
});
|
||||
|
|
@ -97,7 +99,9 @@ export class ProfileFamilyFatherController extends Controller {
|
|||
|
||||
@Get("history/{profileId}")
|
||||
public async familyFatherHistory(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ export class ProfileFamilyFatherEmployeeController extends Controller {
|
|||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getFamilyFather(@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 profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -99,7 +101,9 @@ export class ProfileFamilyFatherEmployeeController 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 profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ export class ProfileFamilyFatherEmployeeTempController extends Controller {
|
|||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getFamilyFather(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -100,7 +101,8 @@ export class ProfileFamilyFatherEmployeeTempController extends Controller {
|
|||
@Path() profileEmployeeId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ export class ProfileFamilyMotherController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getFamilyMother(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileId },
|
||||
});
|
||||
|
|
@ -97,7 +99,9 @@ export class ProfileFamilyMotherController extends Controller {
|
|||
|
||||
@Get("history/{profileId}")
|
||||
public async familyMotherHistory(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ export class ProfileFamilyMotherEmployeeController extends Controller {
|
|||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getFamilyMother(@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 profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -100,7 +102,9 @@ export class ProfileFamilyMotherEmployeeController 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 profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ export class ProfileFamilyMotherEmployeeTempController extends Controller {
|
|||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getFamilyMother(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -100,7 +101,8 @@ export class ProfileFamilyMotherEmployeeTempController extends Controller {
|
|||
@Path() profileEmployeeId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -138,7 +138,9 @@ export class ProfileGovernmentHistoryController extends Controller {
|
|||
@Get("{profileId}")
|
||||
@Example({})
|
||||
public async getGovHistory(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
select: ["id"],
|
||||
where: {
|
||||
|
|
@ -357,7 +359,9 @@ export class ProfileGovernmentHistoryController extends Controller {
|
|||
@Get("history/{profileId}")
|
||||
@Example({})
|
||||
public async govHistory(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const record = await this.govRepo.find({
|
||||
order: { lastUpdatedAt: "DESC" },
|
||||
where: { profileId: profileId },
|
||||
|
|
|
|||
|
|
@ -127,7 +127,9 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
@Get("{profileEmployeeId}")
|
||||
@Example({})
|
||||
public async getGovHistory(@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 orgRevision = await this.orgRevisionRepository.findOne({
|
||||
select: ["id"],
|
||||
where: {
|
||||
|
|
@ -326,7 +328,9 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
@Get("history/{profileEmployeeId}")
|
||||
@Example({})
|
||||
public async govHistory(@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 record = await this.govRepo.find({
|
||||
order: { lastUpdatedAt: "DESC" },
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
|
|
|
|||
|
|
@ -127,7 +127,8 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
|
|||
@Get("{profileEmployeeId}")
|
||||
@Example({})
|
||||
public async getGovHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
select: ["id"],
|
||||
where: {
|
||||
|
|
@ -327,7 +328,8 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
|
|||
@Get("history/{profileEmployeeId}")
|
||||
@Example({})
|
||||
public async govHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.govRepo.find({
|
||||
order: { lastUpdatedAt: "DESC" },
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
|
|
|
|||
|
|
@ -44,7 +44,9 @@ export class ProfileHonorController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getHonor(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const record = await this.honorRepo.find({
|
||||
where: { profileId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -78,7 +80,9 @@ export class ProfileHonorController extends Controller {
|
|||
public async honorAdminHistory(@Path() honorId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.honorRepo.findOneBy({ id: honorId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
let _workflow = await new permission().Workflow(req, honorId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
}
|
||||
const record = await this.honorHistoryRepo.find({
|
||||
where: {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,9 @@ export class ProfileHonorEmployeeController extends Controller {
|
|||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getHonor(@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 record = await this.honorRepo.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -82,11 +84,13 @@ export class ProfileHonorEmployeeController extends Controller {
|
|||
public async honorAdminHistory(@Path() honorId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.honorRepo.findOneBy({ id: honorId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
let _workflow = await new permission().Workflow(req, honorId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
|
||||
const record = await this.honorHistoryRepo.find({
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ export class ProfileHonorEmployeeTempController extends Controller {
|
|||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getHonor(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.honorRepo.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -80,7 +81,8 @@ export class ProfileHonorEmployeeTempController extends Controller {
|
|||
|
||||
@Get("admin/history/{honorId}")
|
||||
public async honorAdminHistory(@Path() honorId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, honorId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.honorHistoryRepo.find({
|
||||
where: {
|
||||
profileHonorId: honorId,
|
||||
|
|
|
|||
|
|
@ -55,7 +55,9 @@ export class ProfileInsigniaController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getInsignia(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const record = await this.insigniaRepo.find({
|
||||
relations: {
|
||||
insignia: {
|
||||
|
|
@ -75,7 +77,9 @@ export class ProfileInsigniaController extends Controller {
|
|||
) {
|
||||
const _record = await this.insigniaRepo.findOneBy({ id: InsigniaId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
let _workflow = await new permission().Workflow(req, InsigniaId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
}
|
||||
const record = await this.insigniaHistoryRepo.find({
|
||||
relations: {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,9 @@ export class ProfileInsigniaEmployeeController extends Controller {
|
|||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getInsignia(@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 record = await this.insigniaRepo.find({
|
||||
relations: {
|
||||
insignia: {
|
||||
|
|
@ -75,11 +77,13 @@ export class ProfileInsigniaEmployeeController extends Controller {
|
|||
) {
|
||||
const _record = await this.insigniaRepo.findOneBy({ id: InsigniaId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
let _workflow = await new permission().Workflow(req, InsigniaId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
const record = await this.insigniaHistoryRepo.find({
|
||||
relations: {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ export class ProfileInsigniaEmployeeTempController extends Controller {
|
|||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getInsignia(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.insigniaRepo.find({
|
||||
relations: {
|
||||
insignia: {
|
||||
|
|
@ -73,7 +74,8 @@ export class ProfileInsigniaEmployeeTempController extends Controller {
|
|||
@Path() InsigniaId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, InsigniaId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.insigniaHistoryRepo.find({
|
||||
relations: {
|
||||
insignia: {
|
||||
|
|
|
|||
|
|
@ -127,7 +127,9 @@ export class ProfileLeaveController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getLeave(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const record = await this.leaveRepo.find({
|
||||
relations: { leaveType: true },
|
||||
where: { profileId },
|
||||
|
|
@ -138,7 +140,8 @@ export class ProfileLeaveController extends Controller {
|
|||
|
||||
@Get("admin/{profileId}")
|
||||
public async getLeaveAdmin(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_SALARY_OFFICER");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_SALARY_OFFICER");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_SALARY_OFFICER");
|
||||
const record = await this.leaveRepo.find({
|
||||
relations: { leaveType: true },
|
||||
where: { profileId },
|
||||
|
|
@ -151,7 +154,9 @@ export class ProfileLeaveController extends Controller {
|
|||
public async leaveAdminHistory(@Path() leaveId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.leaveRepo.findOneBy({ id: leaveId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
let _workflow = await new permission().Workflow(req, leaveId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
}
|
||||
const record = await this.leaveHistoryRepo.find({
|
||||
relations: { leaveType: true },
|
||||
|
|
|
|||
|
|
@ -51,7 +51,9 @@ export class ProfileLeaveEmployeeController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getLeave(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
|
||||
const record = await this.leaveRepo.find({
|
||||
relations: { leaveType: true },
|
||||
where: { profileEmployeeId: profileId },
|
||||
|
|
@ -62,7 +64,8 @@ export class ProfileLeaveEmployeeController extends Controller {
|
|||
|
||||
@Get("admin/{profileId}")
|
||||
public async getLeaveAdmin(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_WAGE");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_WAGE");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_WAGE");
|
||||
const record = await this.leaveRepo.find({
|
||||
relations: { leaveType: true },
|
||||
where: { profileEmployeeId: profileId },
|
||||
|
|
@ -75,11 +78,13 @@ export class ProfileLeaveEmployeeController extends Controller {
|
|||
public async leaveAdminHistory(@Path() leaveId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.leaveRepo.findOneBy({ id: leaveId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
let _workflow = await new permission().Workflow(req, leaveId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
const record = await this.leaveHistoryRepo.find({
|
||||
relations: { leaveType: true },
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ export class ProfileLeaveEmployeeTempController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getLeave(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.leaveRepo.find({
|
||||
relations: { leaveType: true },
|
||||
where: { profileEmployeeId: profileId },
|
||||
|
|
@ -62,7 +63,8 @@ export class ProfileLeaveEmployeeTempController extends Controller {
|
|||
|
||||
@Get("admin/{profileId}")
|
||||
public async getLeaveAdmin(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_WAGE");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_WAGE");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_WAGE");
|
||||
const record = await this.leaveRepo.find({
|
||||
relations: { leaveType: true },
|
||||
where: { profileEmployeeId: profileId },
|
||||
|
|
@ -73,7 +75,8 @@ export class ProfileLeaveEmployeeTempController extends Controller {
|
|||
|
||||
@Get("admin/history/{leaveId}")
|
||||
public async leaveAdminHistory(@Path() leaveId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, leaveId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.leaveHistoryRepo.find({
|
||||
relations: { leaveType: true },
|
||||
where: { profileLeaveId: leaveId },
|
||||
|
|
|
|||
|
|
@ -44,7 +44,9 @@ export class ProfileNopaidController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getNopaid(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const lists = await this.nopaidRepository.find({
|
||||
where: { profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -56,7 +58,9 @@ export class ProfileNopaidController extends Controller {
|
|||
public async nopaidHistory(@Path() nopaidId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.nopaidRepository.findOneBy({ id: nopaidId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
let _workflow = await new permission().Workflow(req, nopaidId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
}
|
||||
const record = await this.nopaidHistoryRepository.find({
|
||||
where: { profileNopaidId: nopaidId },
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ export class ProfileNopaidEmployeeController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getNopaid(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_EMP");
|
||||
const lists = await this.nopaidRepository.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -58,7 +59,8 @@ export class ProfileNopaidEmployeeController extends Controller {
|
|||
|
||||
@Get("history/{nopaidId}")
|
||||
public async nopaidHistory(@Path() nopaidId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, nopaidId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_EMP");
|
||||
const record = await this.nopaidHistoryRepository.find({
|
||||
where: { profileNopaidId: nopaidId },
|
||||
order: { createdAt: "DESC" },
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ export class ProfileNopaidEmployeeTempController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getNopaid(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const lists = await this.nopaidRepository.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -58,7 +59,8 @@ export class ProfileNopaidEmployeeTempController extends Controller {
|
|||
|
||||
@Get("history/{nopaidId}")
|
||||
public async nopaidHistory(@Path() nopaidId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, nopaidId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.nopaidHistoryRepository.find({
|
||||
where: { profileNopaidId: nopaidId },
|
||||
order: { createdAt: "DESC" },
|
||||
|
|
|
|||
|
|
@ -45,7 +45,9 @@ export class ProfileOtherController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getOther(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const lists = await this.otherRepository.find({
|
||||
where: { profileId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -57,7 +59,9 @@ export class ProfileOtherController extends Controller {
|
|||
public async otherAdminHistory(@Path() otherId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.otherRepository.findOneBy({ id: otherId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
let _workflow = await new permission().Workflow(req, otherId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
}
|
||||
const record = await this.otherHistoryRepository.find({
|
||||
where: { profileOtherId: otherId },
|
||||
|
|
|
|||
|
|
@ -48,7 +48,9 @@ export class ProfileOtherEmployeeController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getOther(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
|
||||
const lists = await this.otherRepository.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -60,11 +62,13 @@ export class ProfileOtherEmployeeController extends Controller {
|
|||
public async otherAdminHistory(@Path() otherId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.otherRepository.findOneBy({ id: otherId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
let _workflow = await new permission().Workflow(req, otherId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
const record = await this.otherHistoryRepository.find({
|
||||
where: { profileOtherId: otherId },
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ export class ProfileOtherEmployeeTempController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getOther(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const lists = await this.otherRepository.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -58,7 +59,8 @@ export class ProfileOtherEmployeeTempController extends Controller {
|
|||
|
||||
@Get("admin/history/{otherId}")
|
||||
public async otherAdminHistory(@Path() otherId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, otherId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.otherHistoryRepository.find({
|
||||
where: { profileOtherId: otherId },
|
||||
order: { createdAt: "DESC" },
|
||||
|
|
|
|||
|
|
@ -45,7 +45,9 @@ export class ProfileSalaryController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getSalary(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const record = await this.salaryRepo.find({
|
||||
where: { profileId: profileId },
|
||||
order: { order: "ASC" },
|
||||
|
|
@ -55,7 +57,8 @@ export class ProfileSalaryController extends Controller {
|
|||
|
||||
@Get("admin/{profileId}")
|
||||
public async getSalaryAdmin(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_SALARY_OFFICER");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_SALARY_OFFICER");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_SALARY_OFFICER");
|
||||
const record = await this.salaryRepo.find({
|
||||
where: { profileId: profileId },
|
||||
order: { order: "ASC" },
|
||||
|
|
@ -67,7 +70,9 @@ export class ProfileSalaryController extends Controller {
|
|||
public async salaryAdminHistory(@Path() salaryId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.salaryRepo.findOneBy({ id: salaryId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
let _workflow = await new permission().Workflow(req, salaryId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
}
|
||||
const record = await this.salaryHistoryRepo.find({
|
||||
where: {
|
||||
|
|
@ -208,7 +213,7 @@ export class ProfileSalaryController extends Controller {
|
|||
) {
|
||||
const source_item = await this.salaryRepo.findOne({ where: { id: salaryId } });
|
||||
// if (source_item) {
|
||||
// await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", source_item.profileId);//ไม่แน่ใจOFFปิดไว้ก่อน
|
||||
//await new permission().PermissionOrgUserGet(req,"SYS_REGISTRY_OFFICER",source_item.profileId,); //ไม่แน่ใจOFFปิดไว้ก่อน
|
||||
// }
|
||||
if (source_item == null) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
const sourceOrder = source_item.order;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@ export class ProfileSalaryEmployeeController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getSalaryEmployee(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
|
||||
const record = await this.salaryRepo.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { order: "ASC" },
|
||||
|
|
@ -59,7 +61,8 @@ export class ProfileSalaryEmployeeController extends Controller {
|
|||
|
||||
@Get("admin/{profileId}")
|
||||
public async getSalaryEmployeeAdmin(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_WAGE");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_WAGE");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_WAGE");
|
||||
const record = await this.salaryRepo.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { order: "ASC" },
|
||||
|
|
@ -71,11 +74,13 @@ export class ProfileSalaryEmployeeController extends Controller {
|
|||
public async salaryAdminHistory(@Path() salaryId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.salaryRepo.findOneBy({ id: salaryId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
let _workflow = await new permission().Workflow(req, salaryId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
const record = await this.salaryHistoryRepo.find({
|
||||
where: {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ export class ProfileSalaryEmployeeTempController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getSalaryEmployee(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.salaryRepo.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { order: "ASC" },
|
||||
|
|
@ -59,7 +60,8 @@ export class ProfileSalaryEmployeeTempController extends Controller {
|
|||
|
||||
@Get("admin/{profileId}")
|
||||
public async getSalaryEmployeeAdmin(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_WAGE");
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_WAGE");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_WAGE");
|
||||
const record = await this.salaryRepo.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { order: "ASC" },
|
||||
|
|
@ -69,7 +71,8 @@ export class ProfileSalaryEmployeeTempController extends Controller {
|
|||
|
||||
@Get("admin/history/{salaryId}")
|
||||
public async salaryAdminHistory(@Path() salaryId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, salaryId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.salaryHistoryRepo.find({
|
||||
where: {
|
||||
profileSalaryId: salaryId,
|
||||
|
|
|
|||
|
|
@ -48,7 +48,9 @@ export class ProfileTrainingController extends Controller {
|
|||
|
||||
@Get("{profileId}")
|
||||
public async getTraining(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const record = await this.trainingRepo.find({
|
||||
where: { profileId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -60,7 +62,9 @@ export class ProfileTrainingController extends Controller {
|
|||
public async trainingAdminHistory(@Path() trainingId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.trainingRepo.findOneBy({ id: trainingId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
let _workflow = await new permission().Workflow(req, trainingId, "SYS_REGISTRY_OFFICER");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
}
|
||||
const record = await this.trainingHistoryRepo.find({
|
||||
where: {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,9 @@ export class ProfileTrainingEmployeeController extends Controller {
|
|||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getTraining(@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 record = await this.trainingRepo.find({
|
||||
where: { profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -60,11 +62,13 @@ export class ProfileTrainingEmployeeController extends Controller {
|
|||
public async trainingAdminHistory(@Path() trainingId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.trainingRepo.findOneBy({ id: trainingId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
let _workflow = await new permission().Workflow(req, trainingId, "SYS_REGISTRY_EMP");
|
||||
if (_workflow == false)
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
|
||||
const record = await this.trainingHistoryRepo.find({
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ export class ProfileTrainingEmployeeTempController extends Controller {
|
|||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getTraining(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.trainingRepo.find({
|
||||
where: { profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -58,7 +59,8 @@ export class ProfileTrainingEmployeeTempController extends Controller {
|
|||
|
||||
@Get("admin/history/{trainingId}")
|
||||
public async trainingAdminHistory(@Path() trainingId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
let _workflow = await new permission().Workflow(req, trainingId, "SYS_REGISTRY_TEMP");
|
||||
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.trainingHistoryRepo.find({
|
||||
where: {
|
||||
profileTrainingId: trainingId,
|
||||
|
|
|
|||
|
|
@ -700,4 +700,37 @@ export class WorkflowController extends Controller {
|
|||
let isOfficer = profileOfficer.orgChild1 == null ? false : profileOfficer.orgChild1.isOfficer;
|
||||
return new HttpSuccess({ isOfficer: isOfficer, isStaff: !isOfficer });
|
||||
}
|
||||
|
||||
/**
|
||||
* API เช็ค สกจ
|
||||
*
|
||||
* @summary เช็ค สกจ
|
||||
*
|
||||
*/
|
||||
@Post("keycloak/isofficer")
|
||||
async checkPermissionWorkflow(
|
||||
@Request() req: RequestWithUser,
|
||||
@Body()
|
||||
body: {
|
||||
refId: string;
|
||||
sysName: string;
|
||||
},
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: {
|
||||
keycloak: req.user.sub,
|
||||
},
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งาน");
|
||||
|
||||
const profileOfficer = await this.workflowRepo.findOne({
|
||||
where: {
|
||||
states: { stateUserComments: { profile: { keycloak: req.user.sub } } },
|
||||
refId: body.refId,
|
||||
sysName: body.sysName,
|
||||
},
|
||||
});
|
||||
if (!profileOfficer) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลสิทธิ์");
|
||||
return new HttpSuccess();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,6 +105,12 @@ export class OrgRoot extends EntityBase {
|
|||
})
|
||||
responsibility: string;
|
||||
|
||||
@Column({
|
||||
comment: "เป็นปลัด",
|
||||
default: false,
|
||||
})
|
||||
isDeputy: boolean;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง orgRevision",
|
||||
|
|
@ -164,6 +170,9 @@ export class CreateOrgRoot {
|
|||
|
||||
@Column("uuid")
|
||||
orgRevisionId: string;
|
||||
|
||||
@Column()
|
||||
isDeputy: boolean;
|
||||
}
|
||||
|
||||
export type UpdateOrgRoot = Partial<CreateOrgRoot> & { orgRootRank?: OrgRootRank };
|
||||
|
|
|
|||
|
|
@ -54,16 +54,6 @@ class CheckAuth {
|
|||
.GetData(req, `/org/permission/org/${system}/${action}`)
|
||||
.then(async (x) => {
|
||||
let privilege = x.privilege;
|
||||
// if (action.trim().toLocaleUpperCase() == "CREATE")
|
||||
// privilege = await this.PermissionCreate(req, system);
|
||||
// if (action.trim().toLocaleUpperCase() == "DELETE")
|
||||
// privilege = await this.PermissionDelete(req, system);
|
||||
// if (action.trim().toLocaleUpperCase() == "GET")
|
||||
// privilege = await this.PermissionGet(req, system);
|
||||
// if (action.trim().toLocaleUpperCase() == "LIST")
|
||||
// privilege = await this.PermissionList(req, system);
|
||||
// if (action.trim().toLocaleUpperCase() == "UPDATE")
|
||||
// privilege = await this.PermissionUpdate(req, system);
|
||||
|
||||
let data: any = {
|
||||
root: [null],
|
||||
|
|
@ -149,16 +139,6 @@ class CheckAuth {
|
|||
.GetData(req, `/org/permission/user/${system}/${action}/${profileId}`)
|
||||
.then(async (x) => {
|
||||
let org = x.org;
|
||||
// if (action.trim().toLocaleUpperCase() == "CREATE")
|
||||
// org = await this.PermissionOrgCreate(req, system);
|
||||
// if (action.trim().toLocaleUpperCase() == "DELETE")
|
||||
// org = await this.PermissionOrgDelete(req, system);
|
||||
// if (action.trim().toLocaleUpperCase() == "GET")
|
||||
// org = await this.PermissionOrgGet(req, system);
|
||||
// if (action.trim().toLocaleUpperCase() == "LIST")
|
||||
// org = await this.PermissionOrgList(req, system);
|
||||
// if (action.trim().toLocaleUpperCase() == "UPDATE")
|
||||
// org = await this.PermissionOrgUpdate(req, system);
|
||||
|
||||
if (org.root != null) if (x.orgRootId != org.root[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล";
|
||||
if (org.child1 != null)
|
||||
|
|
@ -180,6 +160,26 @@ class CheckAuth {
|
|||
}
|
||||
});
|
||||
}
|
||||
public async Workflow(req: RequestWithUser, id: string, sysName: string) {
|
||||
if (
|
||||
req.headers.hasOwnProperty("api_key") &&
|
||||
req.headers["api_key"] &&
|
||||
req.headers["api_key"] == process.env.API_KEY
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
return await new CallAPI()
|
||||
.PostData(req, "/org/workflow/keycloak/isofficer", {
|
||||
refId: id,
|
||||
sysName: sysName,
|
||||
})
|
||||
.then((x) => {
|
||||
return true;
|
||||
})
|
||||
.catch((x) => {
|
||||
return false;
|
||||
});
|
||||
}
|
||||
public async PermissionCreate(req: RequestWithUser, system: string) {
|
||||
return await this.Permission(req, system, "CREATE");
|
||||
}
|
||||
|
|
|
|||
14
src/migration/1729505298515-update_root_add_isdeputy.ts
Normal file
14
src/migration/1729505298515-update_root_add_isdeputy.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateRootAddIsdeputy1729505298515 implements MigrationInterface {
|
||||
name = 'UpdateRootAddIsdeputy1729505298515'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD \`isDeputy\` tinyint NOT NULL COMMENT 'เป็นปลัด' DEFAULT 0`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP COLUMN \`isDeputy\``);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue