diff --git a/src/controllers/ProfileAbilityEmployeeTempController.ts b/src/controllers/ProfileAbilityEmployeeTempController.ts index ccb68242..c79e2247 100644 --- a/src/controllers/ProfileAbilityEmployeeTempController.ts +++ b/src/controllers/ProfileAbilityEmployeeTempController.ts @@ -74,7 +74,7 @@ export class ProfileAbilityEmployeeTempController extends Controller { ], }) public async detailProfileAbility(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const getProfileAbilityId = await this.profileAbilityRepo.findBy({ profileEmployeeId }); if (!getProfileAbilityId) { throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); @@ -124,7 +124,7 @@ export class ProfileAbilityEmployeeTempController extends Controller { public async getProfileAbilityHistory(@Path() abilityId: string, @Request() req: RequestWithUser) { const _record = await this.profileAbilityRepo.findOneBy({ id: abilityId }); if (_record) { - await new permission().PermissionDelete(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); } const record = await this.profileAbilityHistoryRepo.findBy({ diff --git a/src/controllers/ProfileAddressEmployeeTempController.ts b/src/controllers/ProfileAddressEmployeeTempController.ts index 715b5a2c..fba122fe 100644 --- a/src/controllers/ProfileAddressEmployeeTempController.ts +++ b/src/controllers/ProfileAddressEmployeeTempController.ts @@ -148,7 +148,7 @@ export class ProfileAddressEmployeeTempController extends Controller { @Path() profileId: string, @Request() req: RequestWithUser, ) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.profileAddressHistoryRepo.find({ where: { profileEmployeeId: profileId }, relations: { diff --git a/src/controllers/ProfileAssessmentsEmployeeTempController.ts b/src/controllers/ProfileAssessmentsEmployeeTempController.ts index c5ebaa91..54e96587 100644 --- a/src/controllers/ProfileAssessmentsEmployeeTempController.ts +++ b/src/controllers/ProfileAssessmentsEmployeeTempController.ts @@ -79,7 +79,7 @@ export class ProfileAssessmentsEmployeeTempController extends Controller { ], }) public async detailProfileAssessments(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const getProfileAssessments = await this.profileAssessmentsRepository.findBy({ profileEmployeeId, }); @@ -133,7 +133,7 @@ export class ProfileAssessmentsEmployeeTempController extends Controller { ], }) public async getProfileAssessmentsHistory(@Path() assessmentId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.profileAssessmentsHistoryRepository.findBy({ profileAssessmentId: assessmentId, }); diff --git a/src/controllers/ProfileAvatarEmployeeTempController.ts b/src/controllers/ProfileAvatarEmployeeTempController.ts index 336e51cc..076d42df 100644 --- a/src/controllers/ProfileAvatarEmployeeTempController.ts +++ b/src/controllers/ProfileAvatarEmployeeTempController.ts @@ -19,7 +19,7 @@ export class ProfileAvatarEmployeeTempController extends Controller { @Path() profileEmployeeId: string, @Request() req: RequestWithUser, ) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const lists = await this.avatarRepository.find({ where: { profileEmployeeId }, }); @@ -28,7 +28,7 @@ export class ProfileAvatarEmployeeTempController extends Controller { @Get("profileEmployeeId/{id}") async getProfile(@Path() id: string, @Request() req: RequestWithUser) { - await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_TEMP", id); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const profile = await this.profileRepository.findOne({ select: ["id", "avatar", "avatarName"], where: { id }, diff --git a/src/controllers/ProfileCertificateEmployeeTempController.ts b/src/controllers/ProfileCertificateEmployeeTempController.ts index add2c370..f63cac2c 100644 --- a/src/controllers/ProfileCertificateEmployeeTempController.ts +++ b/src/controllers/ProfileCertificateEmployeeTempController.ts @@ -68,7 +68,7 @@ export class ProfileCertificateEmployeeTempController extends Controller { ], }) public async getCertificate(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.certificateRepo.findBy({ profileEmployeeId }); return new HttpSuccess(record); } @@ -111,7 +111,7 @@ export class ProfileCertificateEmployeeTempController extends Controller { ], }) public async certificateHistory(@Path() certificateId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.certificateHistoryRepo.findBy({ profileCertificateId: certificateId, }); diff --git a/src/controllers/ProfileChangeNameEmployeeTempController.ts b/src/controllers/ProfileChangeNameEmployeeTempController.ts index 2a4d1b3f..a95a46e4 100644 --- a/src/controllers/ProfileChangeNameEmployeeTempController.ts +++ b/src/controllers/ProfileChangeNameEmployeeTempController.ts @@ -65,7 +65,7 @@ export class ProfileChangeNameEmployeeTempController extends Controller { ], }) public async getChangeName(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const lists = await this.changeNameRepository.find({ where: { profileEmployeeId: profileEmployeeId }, select: ["id", "prefix", "firstName", "lastName", "status"], @@ -100,7 +100,7 @@ export class ProfileChangeNameEmployeeTempController extends Controller { ], }) public async changeNameHistory(@Path() changeNameId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.changeNameHistoryRepository.find({ where: { profileChangeNameId: changeNameId }, select: [ diff --git a/src/controllers/ProfileChildrenEmployeeTempController.ts b/src/controllers/ProfileChildrenEmployeeTempController.ts index 4544c499..deea1fbe 100644 --- a/src/controllers/ProfileChildrenEmployeeTempController.ts +++ b/src/controllers/ProfileChildrenEmployeeTempController.ts @@ -50,7 +50,7 @@ export class ProfileChildrenEmployeeTempController extends Controller { @Get("{profileEmployeeId}") public async getChildren(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const lists = await this.childrenRepository.find({ where: { profileEmployeeId: profileEmployeeId }, }); @@ -59,7 +59,7 @@ export class ProfileChildrenEmployeeTempController extends Controller { @Get("history/{childrenId}") public async childrenHistory(@Path() childrenId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.childrenHistoryRepository.find({ where: { profileChildrenId: childrenId }, order: { createdAt: "DESC" }, diff --git a/src/controllers/ProfileDisciplineEmployeeTempController.ts b/src/controllers/ProfileDisciplineEmployeeTempController.ts index 93c7e2dc..4ada9c77 100644 --- a/src/controllers/ProfileDisciplineEmployeeTempController.ts +++ b/src/controllers/ProfileDisciplineEmployeeTempController.ts @@ -73,7 +73,7 @@ export class ProfileDisciplineEmployeeTempController extends Controller { ], }) public async getDiscipline(@Path() profileId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const lists = await this.disciplineRepository.find({ where: { profileEmployeeId: profileId }, select: [ @@ -113,7 +113,7 @@ export class ProfileDisciplineEmployeeTempController extends Controller { @Get("history/{disciplineId}") public async disciplineHistory(@Path() disciplineId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.disciplineHistoryRepository.find({ where: { profileDisciplineId: disciplineId }, select: [ diff --git a/src/controllers/ProfileDutyEmployeeTempController.ts b/src/controllers/ProfileDutyEmployeeTempController.ts index fe163f57..18a9749e 100644 --- a/src/controllers/ProfileDutyEmployeeTempController.ts +++ b/src/controllers/ProfileDutyEmployeeTempController.ts @@ -52,7 +52,7 @@ export class ProfileDutyEmployeeTempController extends Controller { @Get("{profileId}") public async getDuty(@Path() profileId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const lists = await this.dutyRepository.find({ where: { profileEmployeeId: profileId }, select: [ @@ -70,7 +70,7 @@ export class ProfileDutyEmployeeTempController extends Controller { @Get("history/{dutyId}") public async dutyHistory(@Path() dutyId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.dutyHistoryRepository.find({ where: { profileDutyId: dutyId }, select: [ diff --git a/src/controllers/ProfileEducationsEmployeeTempController.ts b/src/controllers/ProfileEducationsEmployeeTempController.ts index 8df1efb6..4318a5d0 100644 --- a/src/controllers/ProfileEducationsEmployeeTempController.ts +++ b/src/controllers/ProfileEducationsEmployeeTempController.ts @@ -92,7 +92,7 @@ export class ProfileEducationsEmployeeTempController extends Controller { ], }) public async detailProfileEducation(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const getProfileEducation = await this.profileEducationRepo.find({ where: { profileEmployeeId: profileEmployeeId }, }); @@ -170,7 +170,7 @@ export class ProfileEducationsEmployeeTempController extends Controller { ], }) public async getProfileEducationHistory(@Path() educationId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.profileEducationHistoryRepo.findBy({ profileEducationId: educationId, }); diff --git a/src/controllers/ProfileEmployeeTempController.ts b/src/controllers/ProfileEmployeeTempController.ts index cff7ce54..1c7061c1 100644 --- a/src/controllers/ProfileEmployeeTempController.ts +++ b/src/controllers/ProfileEmployeeTempController.ts @@ -578,7 +578,7 @@ export class ProfileEmployeeTempController extends Controller { */ @Post() async createProfile(@Body() body: CreateProfileEmployee, @Request() request: RequestWithUser) { - await new permission().PermissionCreate(request, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP"); if (await this.profileRepo.findOneBy({ citizenId: body.citizenId })) { throw new HttpError( HttpStatus.INTERNAL_SERVER_ERROR, @@ -1325,7 +1325,7 @@ export class ProfileEmployeeTempController extends Controller { @Get("history/{id}") async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) { - // await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน + // await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน const profile = await this.profileHistoryRepo.find({ relations: { posLevel: true, @@ -2672,7 +2672,7 @@ export class ProfileEmployeeTempController extends Controller { */ @Get("profileid/retire/{year}") async getProfileByRetireYear(@Path() year: number, @Request() req: RequestWithUser) { - // await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน + // await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน const profiles = await this.profileRepo .createQueryBuilder("profileEmployee") .leftJoinAndSelect("profileEmployee.posLevel", "posLevel") @@ -2966,7 +2966,7 @@ export class ProfileEmployeeTempController extends Controller { */ @Get("information/history/{profileEmployeeId}") async getInformationHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const profileInformation = await this.profileRepo.find({ relations: { information_histories: true, @@ -3011,7 +3011,7 @@ export class ProfileEmployeeTempController extends Controller { @Path() profileEmployeeId: string, @Request() req: RequestWithUser, ) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const employment = await this.employmentRepository.find({ where: { profileEmployeeId: profileEmployeeId }, order: { createdAt: "ASC" }, diff --git a/src/controllers/ProfileGovernmentEmployeeTempController.ts b/src/controllers/ProfileGovernmentEmployeeTempController.ts index abab93ab..10da980a 100644 --- a/src/controllers/ProfileGovernmentEmployeeTempController.ts +++ b/src/controllers/ProfileGovernmentEmployeeTempController.ts @@ -344,7 +344,7 @@ export class ProfileGovernmentEmployeeTempController extends Controller { @Get("history/{profileEmployeeId}") @Example({}) public async govHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.govRepo.find({ order: { lastUpdatedAt: "DESC" }, where: { profileEmployeeId: profileEmployeeId }, diff --git a/src/controllers/ProfileHonorEmployeeTempController.ts b/src/controllers/ProfileHonorEmployeeTempController.ts index b1d5cfb1..44422f49 100644 --- a/src/controllers/ProfileHonorEmployeeTempController.ts +++ b/src/controllers/ProfileHonorEmployeeTempController.ts @@ -69,7 +69,7 @@ export class ProfileHonorEmployeeTempController extends Controller { ], }) public async getHonor(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.honorRepo.findBy({ profileEmployeeId }); return new HttpSuccess(record); } @@ -81,7 +81,6 @@ export class ProfileHonorEmployeeTempController extends Controller { */ @Get("history/user") public async honorHistoryUser(@Request() request: RequestWithUser) { - await new permission().PermissionGet(request, "SYS_REGISTRY_TEMP"); const profile = await this.profileEmployeeRepo.findOneBy({ keycloak: request.user.sub }); if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); @@ -136,7 +135,7 @@ export class ProfileHonorEmployeeTempController extends Controller { ], }) public async honorHistory(@Path() honorId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.honorHistoryRepo.findBy({ profileHonorId: honorId, }); diff --git a/src/controllers/ProfileInsigniaEmployeeTempController.ts b/src/controllers/ProfileInsigniaEmployeeTempController.ts index f3fd247b..f644fad5 100644 --- a/src/controllers/ProfileInsigniaEmployeeTempController.ts +++ b/src/controllers/ProfileInsigniaEmployeeTempController.ts @@ -84,7 +84,7 @@ export class ProfileInsigniaEmployeeTempController extends Controller { ], }) public async getInsignia(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.insigniaRepo.find({ relations: { insignia: { @@ -152,7 +152,7 @@ export class ProfileInsigniaEmployeeTempController extends Controller { ], }) public async getInsigniaHistory(@Path() InsigniaId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.insigniaHistoryRepo.find({ relations: { insignia: { diff --git a/src/controllers/ProfileLeaveEmployeeTempController.ts b/src/controllers/ProfileLeaveEmployeeTempController.ts index aa413297..237e508b 100644 --- a/src/controllers/ProfileLeaveEmployeeTempController.ts +++ b/src/controllers/ProfileLeaveEmployeeTempController.ts @@ -50,7 +50,7 @@ export class ProfileLeaveEmployeeTempController extends Controller { @Get("{profileId}") public async getLeave(@Path() profileId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.leaveRepo.find({ relations: { leaveType: true }, where: { profileEmployeeId: profileId }, diff --git a/src/controllers/ProfileNopaidEmployeeTempController.ts b/src/controllers/ProfileNopaidEmployeeTempController.ts index b0e6c1e7..42576e68 100644 --- a/src/controllers/ProfileNopaidEmployeeTempController.ts +++ b/src/controllers/ProfileNopaidEmployeeTempController.ts @@ -47,7 +47,7 @@ export class ProfileNopaidEmployeeTempController extends Controller { @Get("{profileId}") public async getNopaid(@Path() profileId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const lists = await this.nopaidRepository.find({ where: { profileEmployeeId: profileId }, }); @@ -56,7 +56,7 @@ export class ProfileNopaidEmployeeTempController extends Controller { @Get("history/{nopaidId}") public async nopaidHistory(@Path() nopaidId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.nopaidHistoryRepository.find({ where: { profileNopaidId: nopaidId }, order: { createdAt: "DESC" }, diff --git a/src/controllers/ProfileOtherEmployeeTempController.ts b/src/controllers/ProfileOtherEmployeeTempController.ts index e5816e9b..7218b7d7 100644 --- a/src/controllers/ProfileOtherEmployeeTempController.ts +++ b/src/controllers/ProfileOtherEmployeeTempController.ts @@ -47,7 +47,7 @@ export class ProfileOtherEmployeeTempController extends Controller { @Get("{profileId}") public async getOther(@Path() profileId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const lists = await this.otherRepository.find({ where: { profileEmployeeId: profileId }, }); @@ -56,7 +56,7 @@ export class ProfileOtherEmployeeTempController extends Controller { @Get("history/{otherId}") public async otherHistory(@Path() otherId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.otherHistoryRepository.find({ where: { profileOtherId: otherId }, order: { createdAt: "DESC" }, diff --git a/src/controllers/ProfileSalaryEmployeeTempController.ts b/src/controllers/ProfileSalaryEmployeeTempController.ts index 8f4be048..1fcf844c 100644 --- a/src/controllers/ProfileSalaryEmployeeTempController.ts +++ b/src/controllers/ProfileSalaryEmployeeTempController.ts @@ -69,7 +69,7 @@ export class ProfileSalaryEmployeeTempController extends Controller { @Get("history/{salaryId}") public async salaryHistory(@Path() salaryId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.salaryHistoryRepo.findBy({ profileSalaryId: salaryId, }); diff --git a/src/controllers/ProfileTrainingEmployeeTempController.ts b/src/controllers/ProfileTrainingEmployeeTempController.ts index 402c4757..a5dd241a 100644 --- a/src/controllers/ProfileTrainingEmployeeTempController.ts +++ b/src/controllers/ProfileTrainingEmployeeTempController.ts @@ -75,7 +75,7 @@ export class ProfileTrainingEmployeeTempController extends Controller { ], }) public async getTraining(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.trainingRepo.findBy({ profileEmployeeId }); return new HttpSuccess(record); } @@ -132,7 +132,7 @@ export class ProfileTrainingEmployeeTempController extends Controller { ], }) public async trainingHistory(@Path() trainingId: string, @Request() req: RequestWithUser) { - await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.trainingHistoryRepo.findBy({ profileTrainingId: trainingId, });