From 877a70ef3da3f2a7c46fb21e31099c48b7f8709e Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Mon, 26 Aug 2024 15:57:09 +0700 Subject: [PATCH] =?UTF-8?q?role=20=E0=B9=80=E0=B8=A1=E0=B8=99=E0=B8=B9=20?= =?UTF-8?q?=E0=B8=A5=E0=B8=B9=E0=B8=81=E0=B8=88=E0=B9=89=E0=B8=B2=E0=B8=87?= =?UTF-8?q?=E0=B8=8A=E0=B8=B1=E0=B9=88=E0=B8=A7=E0=B8=84=E0=B8=A3=E0=B8=B2?= =?UTF-8?q?=E0=B8=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProfileAddressEmployeeTempController.ts | 7 ++- ...rofileAssessmentsEmployeeTempController.ts | 6 ++- .../ProfileAvatarEmployeeTempController.ts | 6 ++- ...rofileCertificateEmployeeTempController.ts | 6 ++- ...ProfileChangeNameEmployeeTempController.ts | 6 ++- .../ProfileChildrenEmployeeTempController.ts | 6 ++- ...ProfileDisciplineEmployeeTempController.ts | 6 ++- .../ProfileDutyEmployeeTempController.ts | 6 ++- ...ProfileEducationsEmployeeTempController.ts | 6 ++- src/controllers/ProfileEmployeeController.ts | 2 +- .../ProfileEmployeeTempController.ts | 47 ++++++++++--------- ...ofileFamilyCoupleEmployeeTempController.ts | 7 ++- ...ofileFamilyFatherEmployeeTempController.ts | 6 ++- ...ofileFamilyMotherEmployeeTempController.ts | 6 ++- ...ProfileGovernmentEmployeeTempController.ts | 6 ++- .../ProfileHonorEmployeeTempController.ts | 7 ++- .../ProfileInsigniaEmployeeTempController.ts | 6 ++- .../ProfileLeaveEmployeeTempController.ts | 6 ++- .../ProfileNopaidEmployeeTempController.ts | 6 ++- .../ProfileOtherEmployeeTempController.ts | 6 ++- .../ProfileSalaryEmployeeTempController.ts | 6 ++- .../ProfileTrainingEmployeeTempController.ts | 6 ++- 22 files changed, 109 insertions(+), 63 deletions(-) diff --git a/src/controllers/ProfileAddressEmployeeTempController.ts b/src/controllers/ProfileAddressEmployeeTempController.ts index b5f7596b..916b7148 100644 --- a/src/controllers/ProfileAddressEmployeeTempController.ts +++ b/src/controllers/ProfileAddressEmployeeTempController.ts @@ -69,7 +69,8 @@ export class ProfileAddressEmployeeTempController extends Controller { * */ @Get("{profileEmployeeId}") - public async detailProfileAddress(@Path() profileEmployeeId: string) { + public async detailProfileAddress(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const getProfileAddress = await this.profileEmployeeRepo.findOne({ where: { id: profileEmployeeId }, select: [ @@ -99,6 +100,7 @@ export class ProfileAddressEmployeeTempController extends Controller { */ @Get("history/user") public async getProfileAddressHistoryUser(@Request() request: RequestWithUser) { + // await new permission().PermissionGet(request, "SYS_REGISTRY_TEMP");//ตสTEMP const profile = await this.profileEmployeeRepo.findOneBy({ keycloak: request.user.sub }); if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); @@ -140,7 +142,8 @@ export class ProfileAddressEmployeeTempController extends Controller { * */ @Get("history/{profileId}") - public async getProfileAddressHistory(@Path() profileId: string) { + public async getProfileAddressHistory(@Path() profileId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(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 b18d4436..70447ad7 100644 --- a/src/controllers/ProfileAssessmentsEmployeeTempController.ts +++ b/src/controllers/ProfileAssessmentsEmployeeTempController.ts @@ -78,7 +78,8 @@ export class ProfileAssessmentsEmployeeTempController extends Controller { }, ], }) - public async detailProfileAssessments(@Path() profileEmployeeId: string) { + public async detailProfileAssessments(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const getProfileAssessments = await this.profileAssessmentsRepository.findBy({ profileEmployeeId, }); @@ -131,7 +132,8 @@ export class ProfileAssessmentsEmployeeTempController extends Controller { }, ], }) - public async getProfileAssessmentsHistory(@Path() assessmentId: string) { + public async getProfileAssessmentsHistory(@Path() assessmentId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(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 2527809d..1478aea9 100644 --- a/src/controllers/ProfileAvatarEmployeeTempController.ts +++ b/src/controllers/ProfileAvatarEmployeeTempController.ts @@ -15,7 +15,8 @@ export class ProfileAvatarEmployeeTempController extends Controller { private avatarRepository = AppDataSource.getRepository(ProfileAvatar); @Get("{profileEmployeeId}") - public async getAvatarEmployee(@Path() profileEmployeeId: string) { + public async getAvatarEmployee(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const lists = await this.avatarRepository.find({ where: { profileEmployeeId }, }); @@ -23,7 +24,8 @@ export class ProfileAvatarEmployeeTempController extends Controller { } @Get("select/{profileEmployeeId}/{id}") - public async selectAvatarEmployee(@Path() profileEmployeeId: string, @Path() id: string) { + public async selectAvatarEmployee(@Path() profileEmployeeId: string, @Path() id: string, @Request() req: RequestWithUser) { + // await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ตสTEMP const result = await this.avatarRepository.findOneBy({ id: id }); if (!result) { throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); diff --git a/src/controllers/ProfileCertificateEmployeeTempController.ts b/src/controllers/ProfileCertificateEmployeeTempController.ts index 4d89a8af..771c6915 100644 --- a/src/controllers/ProfileCertificateEmployeeTempController.ts +++ b/src/controllers/ProfileCertificateEmployeeTempController.ts @@ -67,7 +67,8 @@ export class ProfileCertificateEmployeeTempController extends Controller { }, ], }) - public async getCertificate(@Path() profileEmployeeId: string) { + public async getCertificate(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const record = await this.certificateRepo.findBy({ profileEmployeeId }); return new HttpSuccess(record); } @@ -109,7 +110,8 @@ export class ProfileCertificateEmployeeTempController extends Controller { }, ], }) - public async certificateHistory(@Path() certificateId: string) { + public async certificateHistory(@Path() certificateId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(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 59dd0a1d..33056ec7 100644 --- a/src/controllers/ProfileChangeNameEmployeeTempController.ts +++ b/src/controllers/ProfileChangeNameEmployeeTempController.ts @@ -64,7 +64,8 @@ export class ProfileChangeNameEmployeeTempController extends Controller { }, ], }) - public async getChangeName(@Path() profileEmployeeId: string) { + public async getChangeName(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const lists = await this.changeNameRepository.find({ where: { profileEmployeeId: profileEmployeeId }, select: ["id", "prefix", "firstName", "lastName", "status"], @@ -98,7 +99,8 @@ export class ProfileChangeNameEmployeeTempController extends Controller { }, ], }) - public async changeNameHistory(@Path() changeNameId: string) { + public async changeNameHistory(@Path() changeNameId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(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 77d9fcc1..1f0097f5 100644 --- a/src/controllers/ProfileChildrenEmployeeTempController.ts +++ b/src/controllers/ProfileChildrenEmployeeTempController.ts @@ -49,7 +49,8 @@ export class ProfileChildrenEmployeeTempController extends Controller { } @Get("{profileEmployeeId}") - public async getChildren(@Path() profileEmployeeId: string) { + public async getChildren(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const lists = await this.childrenRepository.find({ where: { profileEmployeeId: profileEmployeeId }, }); @@ -57,7 +58,8 @@ export class ProfileChildrenEmployeeTempController extends Controller { } @Get("history/{childrenId}") - public async childrenHistory(@Path() childrenId: string) { + public async childrenHistory(@Path() childrenId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(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 3b97231e..b0b15db4 100644 --- a/src/controllers/ProfileDisciplineEmployeeTempController.ts +++ b/src/controllers/ProfileDisciplineEmployeeTempController.ts @@ -72,7 +72,8 @@ export class ProfileDisciplineEmployeeTempController extends Controller { }, ], }) - public async getDiscipline(@Path() profileId: string) { + public async getDiscipline(@Path() profileId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const lists = await this.disciplineRepository.find({ where: { profileEmployeeId: profileId }, select: [ @@ -91,7 +92,8 @@ export class ProfileDisciplineEmployeeTempController extends Controller { } @Get("history/{disciplineId}") - public async disciplineHistory(@Path() disciplineId: string) { + public async disciplineHistory(@Path() disciplineId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(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 5948e892..f7c42426 100644 --- a/src/controllers/ProfileDutyEmployeeTempController.ts +++ b/src/controllers/ProfileDutyEmployeeTempController.ts @@ -51,7 +51,8 @@ export class ProfileDutyEmployeeTempController extends Controller { } @Get("{profileId}") - public async getDuty(@Path() profileId: string) { + public async getDuty(@Path() profileId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const lists = await this.dutyRepository.find({ where: { profileEmployeeId: profileId }, select: [ @@ -68,7 +69,8 @@ export class ProfileDutyEmployeeTempController extends Controller { } @Get("history/{dutyId}") - public async dutyHistory(@Path() dutyId: string) { + public async dutyHistory(@Path() dutyId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(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 d832ed3c..61a70b86 100644 --- a/src/controllers/ProfileEducationsEmployeeTempController.ts +++ b/src/controllers/ProfileEducationsEmployeeTempController.ts @@ -91,7 +91,8 @@ export class ProfileEducationsEmployeeTempController extends Controller { }, ], }) - public async detailProfileEducation(@Path() profileEmployeeId: string) { + public async detailProfileEducation(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const getProfileEducation = await this.profileEducationRepo.find({ where: { profileEmployeeId: profileEmployeeId }, }); @@ -168,7 +169,8 @@ export class ProfileEducationsEmployeeTempController extends Controller { }, ], }) - public async getProfileEducationHistory(@Path() educationId: string) { + public async getProfileEducationHistory(@Path() educationId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const record = await this.profileEducationHistoryRepo.findBy({ profileEducationId: educationId, }); diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 892909ee..5258057b 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -1058,7 +1058,7 @@ export class ProfileEmployeeController extends Controller { */ @Get("{id}") async detailProfile(@Path() id: string, @Request() req: RequestWithUser) { - await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id); + // await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id);//ตส const profile = await this.profileRepo.findOne({ relations: { posLevel: true, diff --git a/src/controllers/ProfileEmployeeTempController.ts b/src/controllers/ProfileEmployeeTempController.ts index 211250fe..d3795c3a 100644 --- a/src/controllers/ProfileEmployeeTempController.ts +++ b/src/controllers/ProfileEmployeeTempController.ts @@ -116,7 +116,8 @@ export class ProfileEmployeeTempController extends Controller { * @param {string} id Id โปรไฟล์ */ @Get("kp7-short/{id}") - async kp7ShortById(@Path() id: string) { + async kp7ShortById(@Path() id: string, @Request() req: RequestWithUser) { + 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 { * @param {string} id Id โปรไฟล์ */ @Get("kk1/{id}") - public async getKk1Employee(@Path() id: string) { + public async getKk1Employee(@Path() id: string, @Request() req: RequestWithUser) { + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const profiles = await this.profileRepo.findOne({ // select: [ // "citizenId", @@ -1053,7 +1055,7 @@ export class ProfileEmployeeTempController extends Controller { * @param {string} id Id ทะเบียนประวัติ */ @Get("{id}") - async detailProfile(@Path() id: string) { + async detailProfile(@Path() id: string) {//ตสTEMP const profile = await this.profileRepo.findOne({ relations: { posLevel: true, @@ -1306,7 +1308,8 @@ export class ProfileEmployeeTempController extends Controller { } @Get("history/{id}") - async getProfileHistory(@Path() id: string) { + async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const profile = await this.profileHistoryRepo.find({ relations: { posLevel: true, @@ -2066,7 +2069,7 @@ export class ProfileEmployeeTempController extends Controller { * @param {string} id Id ทะเบียนประวัติลูกจ้างชั่วคราว */ @Put("position/{id}") - async positionProfileEmployee( + async positionProfileEmployee(//ตสTEMP @Request() request: RequestWithUser, @Path() id: string, @Body() body: UpdatePositionTempProfileEmployee, @@ -2198,7 +2201,7 @@ export class ProfileEmployeeTempController extends Controller { * @param {string} id Id ทะเบียนประวัติ */ @Put("citizenId/{id}") - async checkCitizenIdProfile( + async checkCitizenIdProfile(//ตสTEMP @Path() id: string, @Body() requestBody: { citizenId: string }, @@ -2549,7 +2552,7 @@ export class ProfileEmployeeTempController extends Controller { * */ @Get("keycloak/position/{revisionId}") - async getProfileByKeycloakByRevision( + async getProfileByKeycloakByRevision(//ตสTEMP @Path() revisionId: string, @Request() request: { user: Record }, ) { @@ -2649,7 +2652,7 @@ export class ProfileEmployeeTempController extends Controller { * @summary ข้อมูลบุลคลที่มีอายุเกษียณราชการตามปี * */ - @Get("profileid/retire/{year}") + @Get("profileid/retire/{year}")//ตสTEMP async getProfileByRetireYear(@Path() year: number) { const profiles = await this.profileRepo .createQueryBuilder("profileEmployee") @@ -2842,7 +2845,7 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} id Id ทะเบียนประวัติ */ - @Post("leave/{id}") + @Post("leave/{id}")//ตสTEMP async updateLeaveUser( @Path() id: string, @Body() @@ -2877,7 +2880,7 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว */ - @Put("information/{profileEmployeeId}") + @Put("information/{profileEmployeeId}")//ตสTEMP async ProfileEmployeeInformation( @Request() request: RequestWithUser, @Path() profileEmployeeId: string, @@ -2909,7 +2912,7 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว */ - @Get("information/{profileEmployeeId}") + @Get("information/{profileEmployeeId}")//ตสTEMP async getInformationById(@Path() profileEmployeeId: string) { const profileInformation = await this.profileRepo.findOne({ where: { id: profileEmployeeId }, @@ -2939,7 +2942,7 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว */ - @Get("information/history/{profileEmployeeId}") + @Get("information/history/{profileEmployeeId}")//ตสTEMP async getInformationHistory(@Path() profileEmployeeId: string) { const profileInformation = await this.profileRepo.find({ relations: { @@ -2980,7 +2983,7 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว */ - @Get("employment/{profileEmployeeId}") + @Get("employment/{profileEmployeeId}")//ตสTEMP async ProfileEmployeeEmployment(@Path() profileEmployeeId: string) { const employment = await this.employmentRepository.find({ where: { profileEmployeeId: profileEmployeeId }, @@ -3001,7 +3004,7 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} id Id ข้อมูลการจ้าง */ - @Get("employment/id/{id}") + @Get("employment/id/{id}")//ตสTEMP async GetEmploymentById(@Path() id: string) { const employment = await this.employmentRepository.findOne({ where: { id: id }, @@ -3016,7 +3019,7 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} id Id ข้อมูลการจ้าง */ - @Get("employment/history/{id}") + @Get("employment/history/{id}")//ตสTEMP async GetHistoryEmploymentById(@Path() id: string) { const employmentHistory = await this.employmentHistoryRepository.find({ where: { profileEmployeeEmploymentId: id }, @@ -3032,7 +3035,7 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว */ - @Post("employment/{profileEmployeeId}") + @Post("employment/{profileEmployeeId}")//ตสTEMP async CreateEmployment( @Path() profileEmployeeId: string, @Body() body: CreateEmploymentProfileEmployee, @@ -3071,7 +3074,7 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} id Id ข้อมูลการจ้าง */ - @Delete("employment/{id}") + @Delete("employment/{id}")//ตสTEMP async DeleteEmployment(@Path() id: string) { await this.employmentHistoryRepository.delete({ profileEmployeeEmploymentId: id, @@ -3091,7 +3094,7 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} id Id ข้อมูลการจ้าง */ - @Put("employment/{id}") + @Put("employment/{id}")//ตสTEMP async UpdateEmployment( @Request() request: RequestWithUser, @Path() id: string, @@ -3124,7 +3127,7 @@ export class ProfileEmployeeTempController extends Controller { * @summary ORG_038 - ออกคำสั่งลูกจ้าง (ADMIN) # * */ - @Post("report") + @Post("report")//ตสTEMP async sendReport(@Request() request: RequestWithUser, @Body() requestBody: { id: string[] }) { const profiles = await this.profileRepo.find({ where: { id: In(requestBody.id) } }); @@ -3148,7 +3151,7 @@ export class ProfileEmployeeTempController extends Controller { * @summary ORG_038 - ออกคำสั่งลูกจ้าง (ADMIN) # * */ - @Post("report/resume") + @Post("report/resume")//ตสTEMP async doneReport( @Body() body: { @@ -3213,7 +3216,7 @@ export class ProfileEmployeeTempController extends Controller { * @summary ค้นหาข้อมูลทะเบียนประวัติที่ยังไม่เชื่อม keycloak * */ - @Post("search-personal-no-keycloak") + @Post("search-personal-no-keycloak")//ตสTEMP async getProfileBySearchKeywordNoKeyCloak( @Query("page") page: number = 1, @Query("pageSize") pageSize: number = 10, @@ -3379,7 +3382,7 @@ export class ProfileEmployeeTempController extends Controller { * @summary ORG_065 - ข้อมูลทะเบียนประวัติตาม profileid (ADMIN) #70 * */ - @Get("profileid/position/{id}") + @Get("profileid/position/{id}")//ตสTEMP async getProfileByProfileid( @Request() request: { user: Record }, @Path() id: string, diff --git a/src/controllers/ProfileFamilyCoupleEmployeeTempController.ts b/src/controllers/ProfileFamilyCoupleEmployeeTempController.ts index cb4e518d..ca67b5ae 100644 --- a/src/controllers/ProfileFamilyCoupleEmployeeTempController.ts +++ b/src/controllers/ProfileFamilyCoupleEmployeeTempController.ts @@ -77,7 +77,8 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller { profileEmployeeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", }, }) - public async getFamilyCouple(@Path() profileEmployeeId: string) { + public async getFamilyCouple(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const profile = await this.profileRepo.findOne({ where: { id: profileEmployeeId }, }); @@ -112,6 +113,7 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller { */ @Get("history/user") public async familyCoupleHistoryUser(@Request() request: RequestWithUser) { + await new permission().PermissionGet(request, "SYS_REGISTRY_TEMP"); const profile = await this.profileRepo.findOneBy({ keycloak: request.user.sub }); if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); @@ -176,7 +178,8 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller { }, ], }) - public async familyCoupleHistory(@Path() profileEmployeeId: string) { + public async familyCoupleHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const profile = await this.profileRepo.findOne({ where: { id: profileEmployeeId }, }); diff --git a/src/controllers/ProfileFamilyFatherEmployeeTempController.ts b/src/controllers/ProfileFamilyFatherEmployeeTempController.ts index 68937f4f..a07cf53e 100644 --- a/src/controllers/ProfileFamilyFatherEmployeeTempController.ts +++ b/src/controllers/ProfileFamilyFatherEmployeeTempController.ts @@ -73,7 +73,8 @@ export class ProfileFamilyFatherEmployeeTempController extends Controller { profileEmployeeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", }, }) - public async getFamilyFather(@Path() profileEmployeeId: string) { + public async getFamilyFather(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const profile = await this.profileRepo.findOne({ where: { id: profileEmployeeId }, }); @@ -164,7 +165,8 @@ export class ProfileFamilyFatherEmployeeTempController extends Controller { }, ], }) - public async familyFatherHistory(@Path() profileEmployeeId: string) { + public async familyFatherHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const profile = await this.profileRepo.findOne({ where: { id: profileEmployeeId }, }); diff --git a/src/controllers/ProfileFamilyMotherEmployeeTempController.ts b/src/controllers/ProfileFamilyMotherEmployeeTempController.ts index 7551c9a1..ea8228da 100644 --- a/src/controllers/ProfileFamilyMotherEmployeeTempController.ts +++ b/src/controllers/ProfileFamilyMotherEmployeeTempController.ts @@ -73,7 +73,8 @@ export class ProfileFamilyMotherEmployeeTempController extends Controller { profileEmployeeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", }, }) - public async getFamilyMother(@Path() profileEmployeeId: string) { + public async getFamilyMother(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const profile = await this.profileRepo.findOne({ where: { id: profileEmployeeId }, }); @@ -164,7 +165,8 @@ export class ProfileFamilyMotherEmployeeTempController extends Controller { }, ], }) - public async familyMotherHistory(@Path() profileEmployeeId: string) { + public async familyMotherHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const profile = await this.profileRepo.findOne({ where: { id: profileEmployeeId }, }); diff --git a/src/controllers/ProfileGovernmentEmployeeTempController.ts b/src/controllers/ProfileGovernmentEmployeeTempController.ts index 92a9808a..ca6bce3e 100644 --- a/src/controllers/ProfileGovernmentEmployeeTempController.ts +++ b/src/controllers/ProfileGovernmentEmployeeTempController.ts @@ -134,7 +134,8 @@ export class ProfileGovernmentEmployeeTempController extends Controller { */ @Get("{profileEmployeeId}") @Example({}) - public async getGovHistory(@Path() profileEmployeeId: string) { + public async getGovHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const record = await this.profileEmployeeRepo.findOne({ where: { id: profileEmployeeId }, relations: { @@ -240,7 +241,8 @@ export class ProfileGovernmentEmployeeTempController extends Controller { */ @Get("history/{profileEmployeeId}") @Example({}) - public async govHistory(@Path() profileEmployeeId: string) { + public async govHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(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 f728186a..f6f91a92 100644 --- a/src/controllers/ProfileHonorEmployeeTempController.ts +++ b/src/controllers/ProfileHonorEmployeeTempController.ts @@ -68,7 +68,8 @@ export class ProfileHonorEmployeeTempController extends Controller { }, ], }) - public async getHonor(@Path() profileEmployeeId: string) { + public async getHonor(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const record = await this.honorRepo.findBy({ profileEmployeeId }); return new HttpSuccess(record); } @@ -80,6 +81,7 @@ 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 ดังกล่าว"); @@ -133,7 +135,8 @@ export class ProfileHonorEmployeeTempController extends Controller { }, ], }) - public async honorHistory(@Path() honorId: string) { + public async honorHistory(@Path() honorId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(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 6cbd3cc7..df93c8e5 100644 --- a/src/controllers/ProfileInsigniaEmployeeTempController.ts +++ b/src/controllers/ProfileInsigniaEmployeeTempController.ts @@ -83,7 +83,8 @@ export class ProfileInsigniaEmployeeTempController extends Controller { }, ], }) - public async getInsignia(@Path() profileEmployeeId: string) { + public async getInsignia(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const record = await this.insigniaRepo.find({ relations: { insignia: { @@ -150,7 +151,8 @@ export class ProfileInsigniaEmployeeTempController extends Controller { }, ], }) - public async getInsigniaHistory(@Path() InsigniaId: string) { + public async getInsigniaHistory(@Path() InsigniaId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(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 0a47d5f1..f73e2287 100644 --- a/src/controllers/ProfileLeaveEmployeeTempController.ts +++ b/src/controllers/ProfileLeaveEmployeeTempController.ts @@ -49,7 +49,8 @@ export class ProfileLeaveEmployeeTempController extends Controller { } @Get("{profileId}") - public async getLeave(@Path() profileId: string) { + public async getLeave(@Path() profileId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const record = await this.leaveRepo.find({ relations: { leaveType: true }, where: { profileEmployeeId: profileId }, @@ -58,7 +59,8 @@ export class ProfileLeaveEmployeeTempController extends Controller { } @Get("history/{leaveId}") - public async leaveHistory(@Path() leaveId: string) { + public async leaveHistory(@Path() leaveId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const record = await this.leaveHistoryRepo.find({ relations: { leaveType: true }, where: { profileLeaveId: leaveId }, diff --git a/src/controllers/ProfileNopaidEmployeeTempController.ts b/src/controllers/ProfileNopaidEmployeeTempController.ts index b01384ad..cf2b6f89 100644 --- a/src/controllers/ProfileNopaidEmployeeTempController.ts +++ b/src/controllers/ProfileNopaidEmployeeTempController.ts @@ -46,7 +46,8 @@ export class ProfileNopaidEmployeeTempController extends Controller { } @Get("{profileId}") - public async getNopaid(@Path() profileId: string) { + public async getNopaid(@Path() profileId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const lists = await this.nopaidRepository.find({ where: { profileEmployeeId: profileId }, }); @@ -54,7 +55,8 @@ export class ProfileNopaidEmployeeTempController extends Controller { } @Get("history/{nopaidId}") - public async nopaidHistory(@Path() nopaidId: string) { + public async nopaidHistory(@Path() nopaidId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(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 b238c5bc..95e163b8 100644 --- a/src/controllers/ProfileOtherEmployeeTempController.ts +++ b/src/controllers/ProfileOtherEmployeeTempController.ts @@ -46,7 +46,8 @@ export class ProfileOtherEmployeeTempController extends Controller { } @Get("{profileId}") - public async getOther(@Path() profileId: string) { + public async getOther(@Path() profileId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const lists = await this.otherRepository.find({ where: { profileEmployeeId: profileId }, }); @@ -54,7 +55,8 @@ export class ProfileOtherEmployeeTempController extends Controller { } @Get("history/{otherId}") - public async otherHistory(@Path() otherId: string) { + public async otherHistory(@Path() otherId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(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 0f0c93d9..082cf4e8 100644 --- a/src/controllers/ProfileSalaryEmployeeTempController.ts +++ b/src/controllers/ProfileSalaryEmployeeTempController.ts @@ -48,7 +48,8 @@ export class ProfileSalaryEmployeeTempController extends Controller { } @Get("{profileId}") - public async getSalaryEmployee(@Path() profileId: string) { + public async getSalaryEmployee(@Path() profileId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const record = await this.salaryRepo.find({ where: { profileEmployeeId: profileId }, order: { order: "ASC" }, @@ -57,7 +58,8 @@ export class ProfileSalaryEmployeeTempController extends Controller { } @Get("history/{salaryId}") - public async salaryHistory(@Path() salaryId: string) { + public async salaryHistory(@Path() salaryId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(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 978112f2..84904e4b 100644 --- a/src/controllers/ProfileTrainingEmployeeTempController.ts +++ b/src/controllers/ProfileTrainingEmployeeTempController.ts @@ -74,7 +74,8 @@ export class ProfileTrainingEmployeeTempController extends Controller { }, ], }) - public async getTraining(@Path() profileEmployeeId: string) { + public async getTraining(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const record = await this.trainingRepo.findBy({ profileEmployeeId }); return new HttpSuccess(record); } @@ -130,7 +131,8 @@ export class ProfileTrainingEmployeeTempController extends Controller { }, ], }) - public async trainingHistory(@Path() trainingId: string) { + public async trainingHistory(@Path() trainingId: string, @Request() req: RequestWithUser) { + await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); const record = await this.trainingHistoryRepo.findBy({ profileTrainingId: trainingId, });