diff --git a/src/controllers/ProfileAbilityController.ts b/src/controllers/ProfileAbilityController.ts index a4fdf3bc..66a9bb24 100644 --- a/src/controllers/ProfileAbilityController.ts +++ b/src/controllers/ProfileAbilityController.ts @@ -148,12 +148,12 @@ export class ProfileAbilityController extends Controller { if (!body.profileId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId"); } - + const profile = await this.profileRepo.findOneBy({ id: body.profileId }); if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);//ตส + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); const data = new ProfileAbility(); const meta = { @@ -209,7 +209,11 @@ export class ProfileAbilityController extends Controller { public async deleteProfileAbility(@Path() abilityId: string, @Request() req: RequestWithUser) { const _record = await this.profileAbilityRepo.findOneBy({ id: abilityId }); if (_record) { - await new permission().PermissionOrgUserDelete(req,"SYS_REGISTRY_OFFICER",_record.profileId); + await new permission().PermissionOrgUserDelete( + req, + "SYS_REGISTRY_OFFICER", + _record.profileId, + ); } await this.profileAbilityHistoryRepo.delete({ profileAbilityId: abilityId, diff --git a/src/controllers/ProfileAbilityEmployeeController.ts b/src/controllers/ProfileAbilityEmployeeController.ts index f3ac528a..daec855b 100644 --- a/src/controllers/ProfileAbilityEmployeeController.ts +++ b/src/controllers/ProfileAbilityEmployeeController.ts @@ -152,7 +152,7 @@ export class ProfileAbilityEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); const data = new ProfileAbility(); const meta = { diff --git a/src/controllers/ProfileAbilityEmployeeTempController.ts b/src/controllers/ProfileAbilityEmployeeTempController.ts index 987896cc..ccb68242 100644 --- a/src/controllers/ProfileAbilityEmployeeTempController.ts +++ b/src/controllers/ProfileAbilityEmployeeTempController.ts @@ -149,7 +149,7 @@ export class ProfileAbilityEmployeeTempController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); const data = new ProfileAbility(); const meta = { diff --git a/src/controllers/ProfileAddressEmployeeTempController.ts b/src/controllers/ProfileAddressEmployeeTempController.ts index 916b7148..e41b107a 100644 --- a/src/controllers/ProfileAddressEmployeeTempController.ts +++ b/src/controllers/ProfileAddressEmployeeTempController.ts @@ -69,7 +69,10 @@ export class ProfileAddressEmployeeTempController extends Controller { * */ @Get("{profileEmployeeId}") - public async detailProfileAddress(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + 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 }, @@ -100,7 +103,7 @@ export class ProfileAddressEmployeeTempController extends Controller { */ @Get("history/user") public async getProfileAddressHistoryUser(@Request() request: RequestWithUser) { - // await new permission().PermissionGet(request, "SYS_REGISTRY_TEMP");//ตสTEMP + // 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 ดังกล่าว"); @@ -142,7 +145,10 @@ export class ProfileAddressEmployeeTempController extends Controller { * */ @Get("history/{profileId}") - public async getProfileAddressHistory(@Path() profileId: string, @Request() req: RequestWithUser) { + 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 }, diff --git a/src/controllers/ProfileAssessmentsController.ts b/src/controllers/ProfileAssessmentsController.ts index 8fefd219..587ede10 100644 --- a/src/controllers/ProfileAssessmentsController.ts +++ b/src/controllers/ProfileAssessmentsController.ts @@ -163,12 +163,12 @@ export class ProfileAssessmentsController extends Controller { if (!body.profileId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId"); } - + const profile = await this.profileRepo.findOneBy({ id: body.profileId }); if (!profile) { throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);//ตส + await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id); const data = new ProfileAssessment(); const meta = { @@ -194,11 +194,10 @@ export class ProfileAssessmentsController extends Controller { @Request() req: RequestWithUser, @Path() assessmentId: string, ) { - const record = await this.profileAssessmentsRepository.findOneBy({ id: assessmentId }); if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", record.profileId); - + const history = new ProfileAssessmentHistory(); Object.assign(record, body); @@ -227,7 +226,11 @@ export class ProfileAssessmentsController extends Controller { ) { const _record = await this.profileAssessmentsRepository.findOneBy({ id: assessmentId }); if (_record) { - await new permission().PermissionOrgUserDelete(req, "SYS_REGISTRY_OFFICER", _record.profileId); + await new permission().PermissionOrgUserDelete( + req, + "SYS_REGISTRY_OFFICER", + _record.profileId, + ); } await this.profileAssessmentsHistoryRepository.delete({ profileAssessmentId: assessmentId, diff --git a/src/controllers/ProfileAssessmentsEmployeeController.ts b/src/controllers/ProfileAssessmentsEmployeeController.ts index 6fab317b..8d9499aa 100644 --- a/src/controllers/ProfileAssessmentsEmployeeController.ts +++ b/src/controllers/ProfileAssessmentsEmployeeController.ts @@ -160,7 +160,7 @@ export class ProfileAssessmentsEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); const data = new ProfileAssessment(); const meta = { diff --git a/src/controllers/ProfileAssessmentsEmployeeTempController.ts b/src/controllers/ProfileAssessmentsEmployeeTempController.ts index 70447ad7..c5ebaa91 100644 --- a/src/controllers/ProfileAssessmentsEmployeeTempController.ts +++ b/src/controllers/ProfileAssessmentsEmployeeTempController.ts @@ -150,7 +150,7 @@ export class ProfileAssessmentsEmployeeTempController extends Controller { @Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeAssessment, ) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); if (!body.profileEmployeeId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId"); } diff --git a/src/controllers/ProfileAvatarController.ts b/src/controllers/ProfileAvatarController.ts index 08ee1486..d68815a6 100644 --- a/src/controllers/ProfileAvatarController.ts +++ b/src/controllers/ProfileAvatarController.ts @@ -73,7 +73,7 @@ export class ProfileAvatarController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); const data = new ProfileAvatar(); diff --git a/src/controllers/ProfileAvatarEmployeeController.ts b/src/controllers/ProfileAvatarEmployeeController.ts index 3bd3b948..5b1cb79f 100644 --- a/src/controllers/ProfileAvatarEmployeeController.ts +++ b/src/controllers/ProfileAvatarEmployeeController.ts @@ -69,7 +69,7 @@ export class ProfileAvatarEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); const data = new ProfileAvatar(); diff --git a/src/controllers/ProfileAvatarEmployeeTempController.ts b/src/controllers/ProfileAvatarEmployeeTempController.ts index 1478aea9..d779f685 100644 --- a/src/controllers/ProfileAvatarEmployeeTempController.ts +++ b/src/controllers/ProfileAvatarEmployeeTempController.ts @@ -15,7 +15,10 @@ export class ProfileAvatarEmployeeTempController extends Controller { private avatarRepository = AppDataSource.getRepository(ProfileAvatar); @Get("{profileEmployeeId}") - public async getAvatarEmployee(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + 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 }, @@ -24,8 +27,12 @@ export class ProfileAvatarEmployeeTempController extends Controller { } @Get("select/{profileEmployeeId}/{id}") - public async selectAvatarEmployee(@Path() profileEmployeeId: string, @Path() id: string, @Request() req: RequestWithUser) { - // await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ตสTEMP + 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, "ไม่พบข้อมูล"); @@ -56,7 +63,7 @@ export class ProfileAvatarEmployeeTempController extends Controller { @Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeAvatar, ) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); const profile = await this.profileRepository.findOne({ where: { id: body.profileEmployeeId }, }); diff --git a/src/controllers/ProfileCertificateController.ts b/src/controllers/ProfileCertificateController.ts index 6d2441b8..75f00e71 100644 --- a/src/controllers/ProfileCertificateController.ts +++ b/src/controllers/ProfileCertificateController.ts @@ -136,7 +136,7 @@ export class ProfileCertificateController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); const data = new ProfileCertificate(); diff --git a/src/controllers/ProfileCertificateEmployeeController.ts b/src/controllers/ProfileCertificateEmployeeController.ts index 75e52508..6e9fbe26 100644 --- a/src/controllers/ProfileCertificateEmployeeController.ts +++ b/src/controllers/ProfileCertificateEmployeeController.ts @@ -134,7 +134,7 @@ export class ProfileCertificateEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); const data = new ProfileCertificate(); diff --git a/src/controllers/ProfileCertificateEmployeeTempController.ts b/src/controllers/ProfileCertificateEmployeeTempController.ts index 771c6915..add2c370 100644 --- a/src/controllers/ProfileCertificateEmployeeTempController.ts +++ b/src/controllers/ProfileCertificateEmployeeTempController.ts @@ -123,7 +123,7 @@ export class ProfileCertificateEmployeeTempController extends Controller { @Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeCertificate, ) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); if (!body.profileEmployeeId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId"); } diff --git a/src/controllers/ProfileChangeNameController.ts b/src/controllers/ProfileChangeNameController.ts index de4a1600..138c3541 100644 --- a/src/controllers/ProfileChangeNameController.ts +++ b/src/controllers/ProfileChangeNameController.ts @@ -132,7 +132,7 @@ export class ProfileChangeNameController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); const data = new ProfileChangeName(); diff --git a/src/controllers/ProfileChangeNameEmployeeController.ts b/src/controllers/ProfileChangeNameEmployeeController.ts index 880f4010..d4f0225f 100644 --- a/src/controllers/ProfileChangeNameEmployeeController.ts +++ b/src/controllers/ProfileChangeNameEmployeeController.ts @@ -134,7 +134,7 @@ export class ProfileChangeNameEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); const data = new ProfileChangeName(); diff --git a/src/controllers/ProfileChangeNameEmployeeTempController.ts b/src/controllers/ProfileChangeNameEmployeeTempController.ts index 33056ec7..2a4d1b3f 100644 --- a/src/controllers/ProfileChangeNameEmployeeTempController.ts +++ b/src/controllers/ProfileChangeNameEmployeeTempController.ts @@ -122,7 +122,7 @@ export class ProfileChangeNameEmployeeTempController extends Controller { @Request() req: RequestWithUser, @Body() body: CreateProfileChangeNameEmployee, ) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); if (!body.profileEmployeeId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId"); } diff --git a/src/controllers/ProfileChildrenController.ts b/src/controllers/ProfileChildrenController.ts index 5cb15421..f3833bc6 100644 --- a/src/controllers/ProfileChildrenController.ts +++ b/src/controllers/ProfileChildrenController.ts @@ -74,7 +74,7 @@ export class ProfileChildrenController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); const data = new ProfileChildren(); const meta = { diff --git a/src/controllers/ProfileChildrenEmployeeController.ts b/src/controllers/ProfileChildrenEmployeeController.ts index ffd62719..e1756145 100644 --- a/src/controllers/ProfileChildrenEmployeeController.ts +++ b/src/controllers/ProfileChildrenEmployeeController.ts @@ -80,7 +80,7 @@ export class ProfileChildrenEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); const data = new ProfileChildren(); diff --git a/src/controllers/ProfileChildrenEmployeeTempController.ts b/src/controllers/ProfileChildrenEmployeeTempController.ts index 1f0097f5..4544c499 100644 --- a/src/controllers/ProfileChildrenEmployeeTempController.ts +++ b/src/controllers/ProfileChildrenEmployeeTempController.ts @@ -72,7 +72,7 @@ export class ProfileChildrenEmployeeTempController extends Controller { @Request() req: RequestWithUser, @Body() body: CreateProfileChildrenEmployee, ) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); const profile = await this.profileRepository.findOneBy({ id: body.profileEmployeeId }); if (!profile) { diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 188be6d3..726bd206 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -2285,7 +2285,7 @@ export class ProfileController extends Controller { ) { const _record = await this.profileRepo.findOneBy({ id: id }); if (_record) { - await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_OFFICER", id);//ตส + await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_OFFICER", _record.id); //ไม่แน่ใจOFF } const exists = !!body.citizenId && @@ -3159,10 +3159,7 @@ export class ProfileController extends Controller { * */ @Get("profileid/position/{id}") - async getProfileByProfileid( - @Request() request: RequestWithUser, - @Path() id: string, - ) { + async getProfileByProfileid(@Request() request: RequestWithUser, @Path() id: string) { await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_OFFICER", id); const profile = await this.profileRepo.findOne({ where: { id: id }, @@ -3376,10 +3373,7 @@ export class ProfileController extends Controller { * */ @Get("keycloakid/position/{id}") - async getProfileByKeycloakid( - @Request() request: RequestWithUser, - @Path() id: string, - ) { + async getProfileByKeycloakid(@Request() request: RequestWithUser, @Path() id: string) { const profile = await this.profileRepo.findOne({ where: { keycloak: id }, select: ["id"], @@ -3399,10 +3393,7 @@ export class ProfileController extends Controller { * @param id หมายเลขประจำตัวประชาชน (citizenId) */ @Get("citizenid/position/{id}") - async getProfileByCitizenId( - @Request() request: RequestWithUser, - @Path() id: string, - ) { + async getProfileByCitizenId(@Request() request: RequestWithUser, @Path() id: string) { const profile = await this.profileRepo.findOne({ where: { citizenId: id }, relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"], @@ -3410,7 +3401,7 @@ export class ProfileController extends Controller { if (!profile) { throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ"); } - await new permission().PermissionOrgUserList(request, "SYS_REGISTRY_OFFICER", profile.id); + await new permission().PermissionOrgUserList(request, "SYS_REGISTRY_OFFICER", profile.id); const orgRevisionPublish = await this.orgRevisionRepo .createQueryBuilder("orgRevision") @@ -3524,10 +3515,7 @@ export class ProfileController extends Controller { * */ @Get("profileempid/position/{id}") - async getProfileByProfileempid( - @Request() request: RequestWithUser, - @Path() id: string, - ) { + async getProfileByProfileempid(@Request() request: RequestWithUser, @Path() id: string) { await new permission().PermissionOrgUserList(request, "SYS_REGISTRY_OFFICER", id); const profile = await this.profileEmpRepo.findOne({ where: { id: id }, @@ -4848,8 +4836,9 @@ export class ProfileController extends Controller { * @summary ข้อมูลบุลคลที่มีอายุเกษียณราชการตามปี * */ - @Get("profileid/retire/{year}") //ตส - async getProfileByRetireYear(@Path() year: number) { + @Get("profileid/retire/{year}") + async getProfileByRetireYear(@Path() year: number, @Request() req: RequestWithUser) { + // await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_OFFICER", id);//ไม่แน่ใจOFF const profiles = await this.profileRepo .createQueryBuilder("profile") .leftJoinAndSelect("profile.posLevel", "posLevel") diff --git a/src/controllers/ProfileDisciplineController.ts b/src/controllers/ProfileDisciplineController.ts index d1a4a71a..c02abb69 100644 --- a/src/controllers/ProfileDisciplineController.ts +++ b/src/controllers/ProfileDisciplineController.ts @@ -138,7 +138,7 @@ export class ProfileDisciplineController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); const data = new ProfileDiscipline(); diff --git a/src/controllers/ProfileDisciplineEmployeeController.ts b/src/controllers/ProfileDisciplineEmployeeController.ts index 52342235..cfc4e820 100644 --- a/src/controllers/ProfileDisciplineEmployeeController.ts +++ b/src/controllers/ProfileDisciplineEmployeeController.ts @@ -128,7 +128,7 @@ export class ProfileDisciplineEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); const data = new ProfileDiscipline(); diff --git a/src/controllers/ProfileDisciplineEmployeeTempController.ts b/src/controllers/ProfileDisciplineEmployeeTempController.ts index b0b15db4..63c0987a 100644 --- a/src/controllers/ProfileDisciplineEmployeeTempController.ts +++ b/src/controllers/ProfileDisciplineEmployeeTempController.ts @@ -117,7 +117,7 @@ export class ProfileDisciplineEmployeeTempController extends Controller { @Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeDiscipline, ) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); if (!body.profileEmployeeId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId"); } diff --git a/src/controllers/ProfileDutyController.ts b/src/controllers/ProfileDutyController.ts index 76fe9f14..536279bb 100644 --- a/src/controllers/ProfileDutyController.ts +++ b/src/controllers/ProfileDutyController.ts @@ -136,12 +136,12 @@ export class ProfileDutyController extends Controller { if (!body.profileId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId"); } - + const profile = await this.profileRepository.findOneBy({ id: body.profileId }); if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);//ตส + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFF const data = new ProfileDuty(); @@ -195,7 +195,11 @@ export class ProfileDutyController extends Controller { public async deleteDuty(@Path() dutyId: string, @Request() req: RequestWithUser) { const _record = await this.dutyRepository.findOneBy({ id: dutyId }); if (_record) { - await new permission().PermissionOrgUserDelete(req, "SYS_REGISTRY_OFFICER", _record.profileId); + await new permission().PermissionOrgUserDelete( + req, + "SYS_REGISTRY_OFFICER", + _record.profileId, + ); } await this.dutyHistoryRepository.delete({ profileDutyId: dutyId, diff --git a/src/controllers/ProfileDutyEmployeeController.ts b/src/controllers/ProfileDutyEmployeeController.ts index 876c6cf9..620d3130 100644 --- a/src/controllers/ProfileDutyEmployeeController.ts +++ b/src/controllers/ProfileDutyEmployeeController.ts @@ -102,7 +102,7 @@ export class ProfileDutyEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); const data = new ProfileDuty(); diff --git a/src/controllers/ProfileDutyEmployeeTempController.ts b/src/controllers/ProfileDutyEmployeeTempController.ts index f7c42426..fe163f57 100644 --- a/src/controllers/ProfileDutyEmployeeTempController.ts +++ b/src/controllers/ProfileDutyEmployeeTempController.ts @@ -91,7 +91,7 @@ export class ProfileDutyEmployeeTempController extends Controller { @Post() public async newDuty(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeDuty) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); if (!body.profileEmployeeId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId"); } diff --git a/src/controllers/ProfileEducationsController.ts b/src/controllers/ProfileEducationsController.ts index 3f70a451..1ed7a937 100644 --- a/src/controllers/ProfileEducationsController.ts +++ b/src/controllers/ProfileEducationsController.ts @@ -194,7 +194,7 @@ export class ProfileEducationsController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); const data = new ProfileEducation(); const meta = { diff --git a/src/controllers/ProfileEducationsEmployeeController.ts b/src/controllers/ProfileEducationsEmployeeController.ts index 2b763c56..5d70827c 100644 --- a/src/controllers/ProfileEducationsEmployeeController.ts +++ b/src/controllers/ProfileEducationsEmployeeController.ts @@ -197,7 +197,7 @@ export class ProfileEducationsEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); const data = new ProfileEducation(); const meta = { diff --git a/src/controllers/ProfileEducationsEmployeeTempController.ts b/src/controllers/ProfileEducationsEmployeeTempController.ts index 61a70b86..8df1efb6 100644 --- a/src/controllers/ProfileEducationsEmployeeTempController.ts +++ b/src/controllers/ProfileEducationsEmployeeTempController.ts @@ -185,7 +185,7 @@ export class ProfileEducationsEmployeeTempController extends Controller { @Request() req: RequestWithUser, @Body() body: CreateProfileEducationEmployee, ) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); if (!body.profileEmployeeId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId"); } diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 5258057b..51181d05 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -258,7 +258,7 @@ export class ProfileEmployeeController extends Controller { relations: ["currentSubDistrict", "currentDistrict", "currentProvince"], where: { id: id }, }); - if(profiles){ + if (profiles) { await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profiles.id); } const profileOc = await this.profileRepo.findOne({ @@ -580,7 +580,7 @@ export class ProfileEmployeeController extends Controller { * */ @Post() - async createProfile(@Body() body: CreateProfileEmployee, @Request() request: RequestWithUser) { //ตส + async createProfile(@Body() body: CreateProfileEmployee, @Request() request: RequestWithUser) { //ไม่แน่ใจEMP if (await this.profileRepo.findOneBy({ citizenId: body.citizenId })) { throw new HttpError( HttpStatus.INTERNAL_SERVER_ERROR, @@ -633,7 +633,7 @@ export class ProfileEmployeeController extends Controller { @Path() id: string, @Body() body: UpdateProfileEmployee, ) { - await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", id) + await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", id); const exists = !!body.citizenId && (await this.profileRepo.findOne({ @@ -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); //ไม่แน่ใจEMP const profile = await this.profileRepo.findOne({ relations: { posLevel: true, @@ -2077,7 +2077,7 @@ export class ProfileEmployeeController extends Controller { @Path() id: string, @Body() body: UpdatePositionTempProfileEmployee, ) { - await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", id) + await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", id); if (body.posLevelId === "") body.posLevelId = null; if (body.posTypeId === "") body.posTypeId = null; @@ -2211,7 +2211,7 @@ export class ProfileEmployeeController extends Controller { @Body() requestBody: { citizenId: string }, ) { - await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", id) + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", id); const profile = await this.profileRepo.findOne({ where: { id: Not(id), citizenId: requestBody.citizenId }, }); @@ -2657,8 +2657,9 @@ export class ProfileEmployeeController extends Controller { * @summary ข้อมูลบุลคลที่มีอายุเกษียณราชการตามปี * */ - @Get("profileid/retire/{year}") //ตส - async getProfileByRetireYear(@Path() year: number) { + @Get("profileid/retire/{year}") + async getProfileByRetireYear(@Path() year: number, @Request() req: RequestWithUser) { + // await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", id);//ไม่แน่ใจEMP const profiles = await this.profileRepo .createQueryBuilder("profileEmployee") .leftJoinAndSelect("profileEmployee.posLevel", "posLevel") @@ -2861,7 +2862,7 @@ export class ProfileEmployeeController extends Controller { where: { id: id }, }); if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); - await new permission().PermissionOrgUserCreate(request, "SYS_REGISTRY_EMP", profile.id) + await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", profile.id); profile.isLeave = requestBody.isLeave; profile.leaveReason = requestBody.leaveReason; @@ -2892,8 +2893,7 @@ export class ProfileEmployeeController extends Controller { @Path() profileEmployeeId: string, @Body() body: UpdateInformationProfileEmployee, ) { - - await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", profileEmployeeId) + await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", profileEmployeeId); const profileEmp = await this.profileRepo.findOneBy({ id: profileEmployeeId }); if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้"); @@ -2922,7 +2922,7 @@ 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) + await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId); const profileInformation = await this.profileRepo.findOne({ where: { id: profileEmployeeId }, }); @@ -2953,7 +2953,7 @@ export class ProfileEmployeeController extends Controller { */ @Get("information/history/{profileEmployeeId}") async getInformationHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { - await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileEmployeeId) + await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileEmployeeId); const profileInformation = await this.profileRepo.find({ relations: { information_histories: true, @@ -2994,8 +2994,11 @@ export class ProfileEmployeeController extends Controller { * @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว */ @Get("employment/{profileEmployeeId}") - async ProfileEmployeeEmployment(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { - await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileEmployeeId) + async ProfileEmployeeEmployment( + @Path() profileEmployeeId: string, + @Request() req: RequestWithUser, + ) { + await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileEmployeeId); const employment = await this.employmentRepository.find({ where: { profileEmployeeId: profileEmployeeId }, order: { createdAt: "ASC" }, @@ -3021,7 +3024,11 @@ export class ProfileEmployeeController extends Controller { where: { id: id }, }); if (employment) { - await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", employment.profileEmployeeId) + await new permission().PermissionOrgUserGet( + req, + "SYS_REGISTRY_EMP", + employment.profileEmployeeId, + ); } return new HttpSuccess(employment); } @@ -3039,7 +3046,11 @@ export class ProfileEmployeeController extends Controller { where: { id: id }, }); if (employment) { - await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", employment.profileEmployeeId) + await new permission().PermissionOrgUserList( + req, + "SYS_REGISTRY_EMP", + employment.profileEmployeeId, + ); } const employmentHistory = await this.employmentHistoryRepository.find({ where: { profileEmployeeEmploymentId: id }, @@ -3065,7 +3076,7 @@ export class ProfileEmployeeController extends Controller { where: { id: profileEmployeeId }, }); if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); - await new permission().PermissionOrgUserList(request, "SYS_REGISTRY_EMP", profile.id) + await new permission().PermissionOrgUserList(request, "SYS_REGISTRY_EMP", profile.id); const employment = new ProfileEmployeeEmployment(); // const history = new ProfileEmployeeEmploymentHistory(); @@ -3101,7 +3112,11 @@ export class ProfileEmployeeController extends Controller { where: { id: id }, }); if (employment) { - await new permission().PermissionOrgUserDelete(request, "SYS_REGISTRY_EMP", employment.profileEmployeeId) + await new permission().PermissionOrgUserDelete( + request, + "SYS_REGISTRY_EMP", + employment.profileEmployeeId, + ); } await this.employmentHistoryRepository.delete({ profileEmployeeEmploymentId: id, @@ -3127,10 +3142,13 @@ export class ProfileEmployeeController extends Controller { @Path() id: string, @Body() body: UpdateEmploymentProfileEmployee, ) { - const employment = await this.employmentRepository.findOneBy({ id }); if (!employment) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); - await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", employment.profileEmployeeId) + await new permission().PermissionOrgUserUpdate( + request, + "SYS_REGISTRY_EMP", + employment.profileEmployeeId, + ); const history = new ProfileEmployeeEmploymentHistory(); Object.assign(history, { ...employment, id: undefined }); @@ -3412,10 +3430,7 @@ export class ProfileEmployeeController extends Controller { * */ @Get("profileid/position/{id}") - async getProfileByProfileid( - @Request() request: RequestWithUser, - @Path() id: string, - ) { + 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"], diff --git a/src/controllers/ProfileEmployeeTempController.ts b/src/controllers/ProfileEmployeeTempController.ts index d3795c3a..edc3a509 100644 --- a/src/controllers/ProfileEmployeeTempController.ts +++ b/src/controllers/ProfileEmployeeTempController.ts @@ -1055,7 +1055,8 @@ export class ProfileEmployeeTempController extends Controller { * @param {string} id Id ทะเบียนประวัติ */ @Get("{id}") - async detailProfile(@Path() id: string) {//ตสTEMP + async detailProfile(@Path() id: string, @Request() req: RequestWithUser) { + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); //ไม่แน่ใจTEMP const profile = await this.profileRepo.findOne({ relations: { posLevel: true, @@ -2069,11 +2070,12 @@ export class ProfileEmployeeTempController extends Controller { * @param {string} id Id ทะเบียนประวัติลูกจ้างชั่วคราว */ @Put("position/{id}") - async positionProfileEmployee(//ตสTEMP + async positionProfileEmployee( @Request() request: RequestWithUser, @Path() id: string, @Body() body: UpdatePositionTempProfileEmployee, ) { + // await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP if (body.posLevelId === "") body.posLevelId = null; if (body.posTypeId === "") body.posTypeId = null; @@ -2201,7 +2203,7 @@ export class ProfileEmployeeTempController extends Controller { * @param {string} id Id ทะเบียนประวัติ */ @Put("citizenId/{id}") - async checkCitizenIdProfile(//ตสTEMP + async checkCitizenIdProfile( @Path() id: string, @Body() requestBody: { citizenId: string }, @@ -2552,7 +2554,8 @@ export class ProfileEmployeeTempController extends Controller { * */ @Get("keycloak/position/{revisionId}") - async getProfileByKeycloakByRevision(//ตสTEMP + async getProfileByKeycloakByRevision( + //ไม่แน่ใจTEMP @Path() revisionId: string, @Request() request: { user: Record }, ) { @@ -2652,8 +2655,9 @@ export class ProfileEmployeeTempController extends Controller { * @summary ข้อมูลบุลคลที่มีอายุเกษียณราชการตามปี * */ - @Get("profileid/retire/{year}")//ตสTEMP - async getProfileByRetireYear(@Path() year: number) { + @Get("profileid/retire/{year}") + async getProfileByRetireYear(@Path() year: number, @Request() req: RequestWithUser) { + // await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP const profiles = await this.profileRepo .createQueryBuilder("profileEmployee") .leftJoinAndSelect("profileEmployee.posLevel", "posLevel") @@ -2845,13 +2849,14 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} id Id ทะเบียนประวัติ */ - @Post("leave/{id}")//ตสTEMP + @Post("leave/{id}") async updateLeaveUser( @Path() id: string, @Body() requestBody: { isLeave: boolean; leaveReason: string; dateLeave: Date }, @Request() request: { user: Record }, ) { + // await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP const profile = await this.profileRepo.findOne({ where: { id: id }, }); @@ -2880,12 +2885,13 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว */ - @Put("information/{profileEmployeeId}")//ตสTEMP + @Put("information/{profileEmployeeId}") async ProfileEmployeeInformation( @Request() request: RequestWithUser, @Path() profileEmployeeId: string, @Body() body: UpdateInformationProfileEmployee, ) { + // await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP const profileEmp = await this.profileRepo.findOneBy({ id: profileEmployeeId }); if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้"); @@ -2912,8 +2918,9 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว */ - @Get("information/{profileEmployeeId}")//ตสTEMP - async getInformationById(@Path() profileEmployeeId: string) { + @Get("information/{profileEmployeeId}") + async getInformationById(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + // await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP const profileInformation = await this.profileRepo.findOne({ where: { id: profileEmployeeId }, }); @@ -2942,8 +2949,9 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว */ - @Get("information/history/{profileEmployeeId}")//ตสTEMP - async getInformationHistory(@Path() profileEmployeeId: string) { + @Get("information/history/{profileEmployeeId}") + async getInformationHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { + // await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP const profileInformation = await this.profileRepo.find({ relations: { information_histories: true, @@ -2983,8 +2991,12 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว */ - @Get("employment/{profileEmployeeId}")//ตสTEMP - async ProfileEmployeeEmployment(@Path() profileEmployeeId: string) { + @Get("employment/{profileEmployeeId}") + async ProfileEmployeeEmployment( + @Path() profileEmployeeId: string, + @Request() req: RequestWithUser, + ) { + // await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP const employment = await this.employmentRepository.find({ where: { profileEmployeeId: profileEmployeeId }, order: { createdAt: "ASC" }, @@ -3004,8 +3016,9 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} id Id ข้อมูลการจ้าง */ - @Get("employment/id/{id}")//ตสTEMP - async GetEmploymentById(@Path() id: string) { + @Get("employment/id/{id}") + async GetEmploymentById(@Path() id: string, @Request() req: RequestWithUser) { + // await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP const employment = await this.employmentRepository.findOne({ where: { id: id }, }); @@ -3019,8 +3032,9 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} id Id ข้อมูลการจ้าง */ - @Get("employment/history/{id}")//ตสTEMP - async GetHistoryEmploymentById(@Path() id: string) { + @Get("employment/history/{id}") + async GetHistoryEmploymentById(@Path() id: string, @Request() req: RequestWithUser) { + // await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP const employmentHistory = await this.employmentHistoryRepository.find({ where: { profileEmployeeEmploymentId: id }, order: { lastUpdatedAt: "ASC" }, @@ -3035,12 +3049,13 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว */ - @Post("employment/{profileEmployeeId}")//ตสTEMP + @Post("employment/{profileEmployeeId}") async CreateEmployment( @Path() profileEmployeeId: string, @Body() body: CreateEmploymentProfileEmployee, @Request() request: RequestWithUser, ) { + // await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP const profile = await this.profileRepo.findOne({ where: { id: profileEmployeeId }, }); @@ -3074,8 +3089,9 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} id Id ข้อมูลการจ้าง */ - @Delete("employment/{id}")//ตสTEMP + @Delete("employment/{id}") async DeleteEmployment(@Path() id: string) { + // await new permission().PermissionDelete(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP await this.employmentHistoryRepository.delete({ profileEmployeeEmploymentId: id, }); @@ -3094,12 +3110,13 @@ export class ProfileEmployeeTempController extends Controller { * * @param {string} id Id ข้อมูลการจ้าง */ - @Put("employment/{id}")//ตสTEMP + @Put("employment/{id}") async UpdateEmployment( @Request() request: RequestWithUser, @Path() id: string, @Body() body: UpdateEmploymentProfileEmployee, ) { + // await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP const employment = await this.employmentRepository.findOneBy({ id }); if (!employment) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); @@ -3127,8 +3144,9 @@ export class ProfileEmployeeTempController extends Controller { * @summary ORG_038 - ออกคำสั่งลูกจ้าง (ADMIN) # * */ - @Post("report")//ตสTEMP + @Post("report") async sendReport(@Request() request: RequestWithUser, @Body() requestBody: { id: string[] }) { + // await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP const profiles = await this.profileRepo.find({ where: { id: In(requestBody.id) } }); const _profiles = await Promise.all( @@ -3151,7 +3169,7 @@ export class ProfileEmployeeTempController extends Controller { * @summary ORG_038 - ออกคำสั่งลูกจ้าง (ADMIN) # * */ - @Post("report/resume")//ตสTEMP + @Post("report/resume") async doneReport( @Body() body: { @@ -3167,6 +3185,7 @@ export class ProfileEmployeeTempController extends Controller { }, @Request() request: { user: Record }, ) { + // await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP await Promise.all( body.result.map(async (v) => { const profile = await this.profileRepo.findOne({ @@ -3216,7 +3235,7 @@ export class ProfileEmployeeTempController extends Controller { * @summary ค้นหาข้อมูลทะเบียนประวัติที่ยังไม่เชื่อม keycloak * */ - @Post("search-personal-no-keycloak")//ตสTEMP + @Post("search-personal-no-keycloak") async getProfileBySearchKeywordNoKeyCloak( @Query("page") page: number = 1, @Query("pageSize") pageSize: number = 10, @@ -3226,6 +3245,7 @@ export class ProfileEmployeeTempController extends Controller { keyword?: string; }, ) { + // await new permission().PermissionPost(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP let findProfile: any; let total: any; const skip = (page - 1) * pageSize; @@ -3382,11 +3402,9 @@ export class ProfileEmployeeTempController extends Controller { * @summary ORG_065 - ข้อมูลทะเบียนประวัติตาม profileid (ADMIN) #70 * */ - @Get("profileid/position/{id}")//ตสTEMP - async getProfileByProfileid( - @Request() request: { user: Record }, - @Path() id: string, - ) { + @Get("profileid/position/{id}") + async getProfileByProfileid(@Request() req: RequestWithUser, @Path() id: string) { + // await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP const profile = await this.profileRepo.findOne({ where: { id: id }, relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"], diff --git a/src/controllers/ProfileFamilyCoupleController.ts b/src/controllers/ProfileFamilyCoupleController.ts index db377fbe..dcb5ad59 100644 --- a/src/controllers/ProfileFamilyCoupleController.ts +++ b/src/controllers/ProfileFamilyCoupleController.ts @@ -230,7 +230,7 @@ export class ProfileFamilyCoupleController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);//ตส + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFF familyCouple.coupleCitizenId = Extension.CheckCitizen(String(body.coupleCitizenId)); familyCouple.createdUserId = req.user.sub; familyCouple.createdFullName = req.user.name; diff --git a/src/controllers/ProfileFamilyCoupleEmployeeController.ts b/src/controllers/ProfileFamilyCoupleEmployeeController.ts index a4fee20a..dcd472c7 100644 --- a/src/controllers/ProfileFamilyCoupleEmployeeController.ts +++ b/src/controllers/ProfileFamilyCoupleEmployeeController.ts @@ -230,7 +230,7 @@ export class ProfileFamilyCoupleEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); familyCouple.coupleCitizenId = Extension.CheckCitizen(String(body.coupleCitizenId)); familyCouple.createdUserId = req.user.sub; diff --git a/src/controllers/ProfileFamilyCoupleEmployeeTempController.ts b/src/controllers/ProfileFamilyCoupleEmployeeTempController.ts index ca67b5ae..2156e628 100644 --- a/src/controllers/ProfileFamilyCoupleEmployeeTempController.ts +++ b/src/controllers/ProfileFamilyCoupleEmployeeTempController.ts @@ -223,7 +223,7 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller { @Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeFamilyCouple, ) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); const familyCouple = Object.assign(new ProfileFamilyCouple(), body); if (!familyCouple) { throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); diff --git a/src/controllers/ProfileFamilyFatherController.ts b/src/controllers/ProfileFamilyFatherController.ts index 99c1e50c..65426a4c 100644 --- a/src/controllers/ProfileFamilyFatherController.ts +++ b/src/controllers/ProfileFamilyFatherController.ts @@ -216,7 +216,7 @@ export class ProfileFamilyFatherController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);//ตส + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFF familyFather.fatherCitizenId = Extension.CheckCitizen(String(body.fatherCitizenId)); familyFather.createdUserId = req.user.sub; familyFather.createdFullName = req.user.name; @@ -239,7 +239,7 @@ export class ProfileFamilyFatherController extends Controller { @Body() body: UpdateProfileFamilyFather, @Path() profileId: string, ) { - await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profileId);//ตส + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profileId); //ไม่แน่ใจOFF const familyFather = await this.ProfileFamilyFather.findOneBy({ profileId: profileId }); if (!familyFather) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); diff --git a/src/controllers/ProfileFamilyFatherEmployeeController.ts b/src/controllers/ProfileFamilyFatherEmployeeController.ts index eb5d7e29..1260f95f 100644 --- a/src/controllers/ProfileFamilyFatherEmployeeController.ts +++ b/src/controllers/ProfileFamilyFatherEmployeeController.ts @@ -215,7 +215,7 @@ export class ProfileFamilyFatherEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); familyFather.fatherCitizenId = Extension.CheckCitizen(String(body.fatherCitizenId)); familyFather.createdUserId = req.user.sub; familyFather.createdFullName = req.user.name; diff --git a/src/controllers/ProfileFamilyFatherEmployeeTempController.ts b/src/controllers/ProfileFamilyFatherEmployeeTempController.ts index a07cf53e..dfb73e31 100644 --- a/src/controllers/ProfileFamilyFatherEmployeeTempController.ts +++ b/src/controllers/ProfileFamilyFatherEmployeeTempController.ts @@ -208,7 +208,7 @@ export class ProfileFamilyFatherEmployeeTempController extends Controller { @Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeFamilyFather, ) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); const familyFather = Object.assign(new ProfileFamilyFather(), body); if (!familyFather) { throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); diff --git a/src/controllers/ProfileFamilyMotherController.ts b/src/controllers/ProfileFamilyMotherController.ts index 77965d49..923ee636 100644 --- a/src/controllers/ProfileFamilyMotherController.ts +++ b/src/controllers/ProfileFamilyMotherController.ts @@ -215,7 +215,7 @@ export class ProfileFamilyMotherController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER",profile.id);//ตส + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFF familyMother.motherCitizenId = Extension.CheckCitizen(String(body.motherCitizenId)); familyMother.createdUserId = req.user.sub; familyMother.createdFullName = req.user.name; @@ -238,7 +238,7 @@ export class ProfileFamilyMotherController extends Controller { @Body() body: UpdateProfileFamilyMother, @Path() profileId: string, ) { - await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER",profileId);//ตส + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profileId); //ไม่แน่ใจOFF const familyMother = await this.ProfileFamilyMother.findOneBy({ profileId: profileId }); if (!familyMother) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); diff --git a/src/controllers/ProfileFamilyMotherEmployeeController.ts b/src/controllers/ProfileFamilyMotherEmployeeController.ts index 0ae986f5..b4391dbd 100644 --- a/src/controllers/ProfileFamilyMotherEmployeeController.ts +++ b/src/controllers/ProfileFamilyMotherEmployeeController.ts @@ -215,7 +215,7 @@ export class ProfileFamilyMotherEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); familyMother.motherCitizenId = Extension.CheckCitizen(String(body.motherCitizenId)); familyMother.createdUserId = req.user.sub; familyMother.createdFullName = req.user.name; diff --git a/src/controllers/ProfileFamilyMotherEmployeeTempController.ts b/src/controllers/ProfileFamilyMotherEmployeeTempController.ts index ea8228da..12a2973a 100644 --- a/src/controllers/ProfileFamilyMotherEmployeeTempController.ts +++ b/src/controllers/ProfileFamilyMotherEmployeeTempController.ts @@ -208,7 +208,7 @@ export class ProfileFamilyMotherEmployeeTempController extends Controller { @Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeFamilyMother, ) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); const familyMother = Object.assign(new ProfileFamilyMother(), body); if (!familyMother) { throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); diff --git a/src/controllers/ProfileHonorController.ts b/src/controllers/ProfileHonorController.ts index f6f904fc..20ebc37c 100644 --- a/src/controllers/ProfileHonorController.ts +++ b/src/controllers/ProfileHonorController.ts @@ -152,7 +152,7 @@ export class ProfileHonorController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); const data = new ProfileHonor(); diff --git a/src/controllers/ProfileHonorEmployeeController.ts b/src/controllers/ProfileHonorEmployeeController.ts index 6f51e2e0..c36bc441 100644 --- a/src/controllers/ProfileHonorEmployeeController.ts +++ b/src/controllers/ProfileHonorEmployeeController.ts @@ -156,7 +156,7 @@ export class ProfileHonorEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); const data = new ProfileHonor(); diff --git a/src/controllers/ProfileHonorEmployeeTempController.ts b/src/controllers/ProfileHonorEmployeeTempController.ts index f6f91a92..b1d5cfb1 100644 --- a/src/controllers/ProfileHonorEmployeeTempController.ts +++ b/src/controllers/ProfileHonorEmployeeTempController.ts @@ -145,7 +145,7 @@ export class ProfileHonorEmployeeTempController extends Controller { @Post() public async newHonor(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeHonor) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); if (!body.profileEmployeeId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId"); } diff --git a/src/controllers/ProfileInsigniaController.ts b/src/controllers/ProfileInsigniaController.ts index 9a868b0e..9fa2de4c 100644 --- a/src/controllers/ProfileInsigniaController.ts +++ b/src/controllers/ProfileInsigniaController.ts @@ -179,7 +179,7 @@ export class ProfileInsigniaController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); const insignia = await this.insigniaMetaRepo.findOne({ where: { id: body.insigniaId }, diff --git a/src/controllers/ProfileInsigniaEmployeeController.ts b/src/controllers/ProfileInsigniaEmployeeController.ts index 5a7dc6b0..b128eb06 100644 --- a/src/controllers/ProfileInsigniaEmployeeController.ts +++ b/src/controllers/ProfileInsigniaEmployeeController.ts @@ -182,7 +182,7 @@ export class ProfileInsigniaEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id) + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id) const insignia = await this.insigniaMetaRepo.findOne({ where: { id: body.insigniaId }, diff --git a/src/controllers/ProfileInsigniaEmployeeTempController.ts b/src/controllers/ProfileInsigniaEmployeeTempController.ts index df93c8e5..f3fd247b 100644 --- a/src/controllers/ProfileInsigniaEmployeeTempController.ts +++ b/src/controllers/ProfileInsigniaEmployeeTempController.ts @@ -171,7 +171,7 @@ export class ProfileInsigniaEmployeeTempController extends Controller { @Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeInsignia, ) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); if (!body.profileEmployeeId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId"); } diff --git a/src/controllers/ProfileLeaveController.ts b/src/controllers/ProfileLeaveController.ts index 3ea4e820..3dcc6786 100644 --- a/src/controllers/ProfileLeaveController.ts +++ b/src/controllers/ProfileLeaveController.ts @@ -260,7 +260,7 @@ export class ProfileLeaveController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); const leaveType = await this.leaveTypeRepository.findOne({ where: { id: body.leaveTypeId }, diff --git a/src/controllers/ProfileLeaveEmployeeController.ts b/src/controllers/ProfileLeaveEmployeeController.ts index 4d9eb639..9064de06 100644 --- a/src/controllers/ProfileLeaveEmployeeController.ts +++ b/src/controllers/ProfileLeaveEmployeeController.ts @@ -82,7 +82,7 @@ export class ProfileLeaveEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); const leaveType = await this.leaveTypeRepository.findOne({ where: { id: body.leaveTypeId }, diff --git a/src/controllers/ProfileLeaveEmployeeTempController.ts b/src/controllers/ProfileLeaveEmployeeTempController.ts index f73e2287..5e6002d1 100644 --- a/src/controllers/ProfileLeaveEmployeeTempController.ts +++ b/src/controllers/ProfileLeaveEmployeeTempController.ts @@ -70,7 +70,7 @@ export class ProfileLeaveEmployeeTempController extends Controller { @Post() public async newLeave(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeLeave) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); if (!body.profileEmployeeId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId"); } diff --git a/src/controllers/ProfileNopaidController.ts b/src/controllers/ProfileNopaidController.ts index 5165d5bc..605dc286 100644 --- a/src/controllers/ProfileNopaidController.ts +++ b/src/controllers/ProfileNopaidController.ts @@ -109,7 +109,7 @@ export class ProfileNopaidController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); const data = new ProfileNopaid(); diff --git a/src/controllers/ProfileNopaidEmployeeController.ts b/src/controllers/ProfileNopaidEmployeeController.ts index 9670d9c2..03be8ed3 100644 --- a/src/controllers/ProfileNopaidEmployeeController.ts +++ b/src/controllers/ProfileNopaidEmployeeController.ts @@ -76,7 +76,7 @@ export class ProfileNopaidEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); const data = new ProfileNopaid(); diff --git a/src/controllers/ProfileNopaidEmployeeTempController.ts b/src/controllers/ProfileNopaidEmployeeTempController.ts index cf2b6f89..b0e6c1e7 100644 --- a/src/controllers/ProfileNopaidEmployeeTempController.ts +++ b/src/controllers/ProfileNopaidEmployeeTempController.ts @@ -69,7 +69,7 @@ export class ProfileNopaidEmployeeTempController extends Controller { @Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeNopaid, ) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); if (!body.profileEmployeeId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId"); } diff --git a/src/controllers/ProfileOtherController.ts b/src/controllers/ProfileOtherController.ts index 8109372e..c6524d1e 100644 --- a/src/controllers/ProfileOtherController.ts +++ b/src/controllers/ProfileOtherController.ts @@ -106,7 +106,7 @@ export class ProfileOtherController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); const data = new ProfileOther(); diff --git a/src/controllers/ProfileOtherEmployeeController.ts b/src/controllers/ProfileOtherEmployeeController.ts index d0249619..9af3e2f0 100644 --- a/src/controllers/ProfileOtherEmployeeController.ts +++ b/src/controllers/ProfileOtherEmployeeController.ts @@ -77,7 +77,7 @@ export class ProfileOtherEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); const data = new ProfileOther(); diff --git a/src/controllers/ProfileOtherEmployeeTempController.ts b/src/controllers/ProfileOtherEmployeeTempController.ts index 95e163b8..e5816e9b 100644 --- a/src/controllers/ProfileOtherEmployeeTempController.ts +++ b/src/controllers/ProfileOtherEmployeeTempController.ts @@ -66,7 +66,7 @@ export class ProfileOtherEmployeeTempController extends Controller { @Post() public async newOther(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeOther) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); if (!body.profileEmployeeId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId"); } diff --git a/src/controllers/ProfileSalaryController.ts b/src/controllers/ProfileSalaryController.ts index 5ad8459c..71891513 100644 --- a/src/controllers/ProfileSalaryController.ts +++ b/src/controllers/ProfileSalaryController.ts @@ -153,7 +153,7 @@ export class ProfileSalaryController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); const dest_item = await this.salaryRepo.findOne({ where: { profileId: body.profileId }, diff --git a/src/controllers/ProfileSalaryEmployeeController.ts b/src/controllers/ProfileSalaryEmployeeController.ts index 19331c24..fdb3aa2f 100644 --- a/src/controllers/ProfileSalaryEmployeeController.ts +++ b/src/controllers/ProfileSalaryEmployeeController.ts @@ -85,7 +85,7 @@ export class ProfileSalaryEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); const dest_item = await this.salaryRepo.findOne({ where: { profileEmployeeId: body.profileEmployeeId }, diff --git a/src/controllers/ProfileSalaryEmployeeTempController.ts b/src/controllers/ProfileSalaryEmployeeTempController.ts index 082cf4e8..e494f7ca 100644 --- a/src/controllers/ProfileSalaryEmployeeTempController.ts +++ b/src/controllers/ProfileSalaryEmployeeTempController.ts @@ -71,7 +71,7 @@ export class ProfileSalaryEmployeeTempController extends Controller { @Request() req: RequestWithUser, @Body() body: CreateProfileSalaryEmployee, ) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); if (!body.profileEmployeeId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId"); } diff --git a/src/controllers/ProfileTrainingController.ts b/src/controllers/ProfileTrainingController.ts index 800d613c..798ec873 100644 --- a/src/controllers/ProfileTrainingController.ts +++ b/src/controllers/ProfileTrainingController.ts @@ -152,7 +152,7 @@ export class ProfileTrainingController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); const data = new ProfileTraining(); diff --git a/src/controllers/ProfileTrainingEmployeeController.ts b/src/controllers/ProfileTrainingEmployeeController.ts index 0056b321..e844b3ce 100644 --- a/src/controllers/ProfileTrainingEmployeeController.ts +++ b/src/controllers/ProfileTrainingEmployeeController.ts @@ -156,7 +156,7 @@ export class ProfileTrainingEmployeeController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id); const data = new ProfileTraining(); diff --git a/src/controllers/ProfileTrainingEmployeeTempController.ts b/src/controllers/ProfileTrainingEmployeeTempController.ts index 84904e4b..402c4757 100644 --- a/src/controllers/ProfileTrainingEmployeeTempController.ts +++ b/src/controllers/ProfileTrainingEmployeeTempController.ts @@ -144,7 +144,7 @@ export class ProfileTrainingEmployeeTempController extends Controller { @Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeTraining, ) { - await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP"); + await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); if (!body.profileEmployeeId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId"); }