diff --git a/src/controllers/ProfileAddressEmployeeTempController.ts b/src/controllers/ProfileAddressEmployeeTempController.ts index e41b107a..715b5a2c 100644 --- a/src/controllers/ProfileAddressEmployeeTempController.ts +++ b/src/controllers/ProfileAddressEmployeeTempController.ts @@ -103,7 +103,6 @@ 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 ดังกล่าว"); diff --git a/src/controllers/ProfileAvatarEmployeeTempController.ts b/src/controllers/ProfileAvatarEmployeeTempController.ts index d779f685..ad2cbd58 100644 --- a/src/controllers/ProfileAvatarEmployeeTempController.ts +++ b/src/controllers/ProfileAvatarEmployeeTempController.ts @@ -32,7 +32,7 @@ export class ProfileAvatarEmployeeTempController extends Controller { @Path() id: string, @Request() req: RequestWithUser, ) { - await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); //ไม่แน่ใจTEMP + // 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/ProfileController.ts b/src/controllers/ProfileController.ts index 726bd206..fb553914 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", _record.id); //ไม่แน่ใจOFF + await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_OFFICER", _record.id); } const exists = !!body.citizenId && @@ -4838,7 +4838,7 @@ export class ProfileController extends Controller { */ @Get("profileid/retire/{year}") async getProfileByRetireYear(@Path() year: number, @Request() req: RequestWithUser) { - // await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_OFFICER", id);//ไม่แน่ใจOFF + // 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/ProfileDutyController.ts b/src/controllers/ProfileDutyController.ts index 536279bb..39383f82 100644 --- a/src/controllers/ProfileDutyController.ts +++ b/src/controllers/ProfileDutyController.ts @@ -141,7 +141,7 @@ export class ProfileDutyController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFF + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); const data = new ProfileDuty(); diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 51181d05..492ea65a 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -580,7 +580,8 @@ export class ProfileEmployeeController extends Controller { * */ @Post() - async createProfile(@Body() body: CreateProfileEmployee, @Request() request: RequestWithUser) { //ไม่แน่ใจEMP + async createProfile(@Body() body: CreateProfileEmployee, @Request() request: RequestWithUser) { + //ไม่แน่ใจEMPปิดไว้ก่อน if (await this.profileRepo.findOneBy({ citizenId: body.citizenId })) { throw new HttpError( HttpStatus.INTERNAL_SERVER_ERROR, @@ -1058,7 +1059,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); //ไม่แน่ใจEMP + await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id); const profile = await this.profileRepo.findOne({ relations: { posLevel: true, @@ -2659,7 +2660,7 @@ export class ProfileEmployeeController extends Controller { */ @Get("profileid/retire/{year}") async getProfileByRetireYear(@Path() year: number, @Request() req: RequestWithUser) { - // await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", id);//ไม่แน่ใจEMP + // await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", id);//ไม่แน่ใจEMPปิดไว้ก่อน const profiles = await this.profileRepo .createQueryBuilder("profileEmployee") .leftJoinAndSelect("profileEmployee.posLevel", "posLevel") @@ -2862,7 +2863,7 @@ export class ProfileEmployeeController extends Controller { where: { id: id }, }); if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); - await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", profile.id); + await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", profile.id);//ไม่แน่ใจEMPปิดไว้ก่อน profile.isLeave = requestBody.isLeave; profile.leaveReason = requestBody.leaveReason; diff --git a/src/controllers/ProfileEmployeeTempController.ts b/src/controllers/ProfileEmployeeTempController.ts index edc3a509..804c06e9 100644 --- a/src/controllers/ProfileEmployeeTempController.ts +++ b/src/controllers/ProfileEmployeeTempController.ts @@ -1056,7 +1056,7 @@ export class ProfileEmployeeTempController extends Controller { */ @Get("{id}") async detailProfile(@Path() id: string, @Request() req: RequestWithUser) { - await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); //ไม่แน่ใจTEMP + await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); const profile = await this.profileRepo.findOne({ relations: { posLevel: true, @@ -2075,7 +2075,7 @@ export class ProfileEmployeeTempController extends Controller { @Path() id: string, @Body() body: UpdatePositionTempProfileEmployee, ) { - // await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP + // await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน if (body.posLevelId === "") body.posLevelId = null; if (body.posTypeId === "") body.posTypeId = null; @@ -2555,7 +2555,7 @@ export class ProfileEmployeeTempController extends Controller { */ @Get("keycloak/position/{revisionId}") async getProfileByKeycloakByRevision( - //ไม่แน่ใจTEMP + //ไม่แน่ใจTEMPปิดไว้ก่อน @Path() revisionId: string, @Request() request: { user: Record }, ) { @@ -2657,7 +2657,7 @@ export class ProfileEmployeeTempController extends Controller { */ @Get("profileid/retire/{year}") async getProfileByRetireYear(@Path() year: number, @Request() req: RequestWithUser) { - // await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP + // await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน const profiles = await this.profileRepo .createQueryBuilder("profileEmployee") .leftJoinAndSelect("profileEmployee.posLevel", "posLevel") @@ -2856,7 +2856,7 @@ export class ProfileEmployeeTempController extends Controller { requestBody: { isLeave: boolean; leaveReason: string; dateLeave: Date }, @Request() request: { user: Record }, ) { - // await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP + // await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน const profile = await this.profileRepo.findOne({ where: { id: id }, }); @@ -2891,7 +2891,7 @@ export class ProfileEmployeeTempController extends Controller { @Path() profileEmployeeId: string, @Body() body: UpdateInformationProfileEmployee, ) { - // await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP + // 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, "ไม่พบข้อมูลโปรไฟล์นี้"); @@ -2920,7 +2920,7 @@ export class ProfileEmployeeTempController extends Controller { */ @Get("information/{profileEmployeeId}") async getInformationById(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { - // await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP + // await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน const profileInformation = await this.profileRepo.findOne({ where: { id: profileEmployeeId }, }); @@ -2951,7 +2951,7 @@ export class ProfileEmployeeTempController extends Controller { */ @Get("information/history/{profileEmployeeId}") async getInformationHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { - // await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP + // await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน const profileInformation = await this.profileRepo.find({ relations: { information_histories: true, @@ -2996,7 +2996,7 @@ export class ProfileEmployeeTempController extends Controller { @Path() profileEmployeeId: string, @Request() req: RequestWithUser, ) { - // await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP + // await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน const employment = await this.employmentRepository.find({ where: { profileEmployeeId: profileEmployeeId }, order: { createdAt: "ASC" }, @@ -3018,7 +3018,7 @@ export class ProfileEmployeeTempController extends Controller { */ @Get("employment/id/{id}") async GetEmploymentById(@Path() id: string, @Request() req: RequestWithUser) { - // await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP + // await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน const employment = await this.employmentRepository.findOne({ where: { id: id }, }); @@ -3034,7 +3034,7 @@ export class ProfileEmployeeTempController extends Controller { */ @Get("employment/history/{id}") async GetHistoryEmploymentById(@Path() id: string, @Request() req: RequestWithUser) { - // await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP + // await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน const employmentHistory = await this.employmentHistoryRepository.find({ where: { profileEmployeeEmploymentId: id }, order: { lastUpdatedAt: "ASC" }, @@ -3055,7 +3055,7 @@ export class ProfileEmployeeTempController extends Controller { @Body() body: CreateEmploymentProfileEmployee, @Request() request: RequestWithUser, ) { - // await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP + // await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน const profile = await this.profileRepo.findOne({ where: { id: profileEmployeeId }, }); @@ -3091,7 +3091,7 @@ export class ProfileEmployeeTempController extends Controller { */ @Delete("employment/{id}") async DeleteEmployment(@Path() id: string) { - // await new permission().PermissionDelete(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP + // await new permission().PermissionDelete(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน await this.employmentHistoryRepository.delete({ profileEmployeeEmploymentId: id, }); @@ -3116,7 +3116,7 @@ export class ProfileEmployeeTempController extends Controller { @Path() id: string, @Body() body: UpdateEmploymentProfileEmployee, ) { - // await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP + // await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน const employment = await this.employmentRepository.findOneBy({ id }); if (!employment) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); @@ -3146,7 +3146,7 @@ export class ProfileEmployeeTempController extends Controller { */ @Post("report") async sendReport(@Request() request: RequestWithUser, @Body() requestBody: { id: string[] }) { - // await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP + // 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( @@ -3185,7 +3185,7 @@ export class ProfileEmployeeTempController extends Controller { }, @Request() request: { user: Record }, ) { - // await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP + // await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน await Promise.all( body.result.map(async (v) => { const profile = await this.profileRepo.findOne({ @@ -3245,7 +3245,7 @@ export class ProfileEmployeeTempController extends Controller { keyword?: string; }, ) { - // await new permission().PermissionPost(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP + // await new permission().PermissionPost(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน let findProfile: any; let total: any; const skip = (page - 1) * pageSize; @@ -3404,7 +3404,7 @@ export class ProfileEmployeeTempController extends Controller { */ @Get("profileid/position/{id}") async getProfileByProfileid(@Request() req: RequestWithUser, @Path() id: string) { - // await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP + // 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 dcb5ad59..7458feed 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().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFF + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); familyCouple.coupleCitizenId = Extension.CheckCitizen(String(body.coupleCitizenId)); familyCouple.createdUserId = req.user.sub; familyCouple.createdFullName = req.user.name; diff --git a/src/controllers/ProfileFamilyFatherController.ts b/src/controllers/ProfileFamilyFatherController.ts index 65426a4c..8797c9e9 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().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFF + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); 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); //ไม่แน่ใจOFF + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profileId); const familyFather = await this.ProfileFamilyFather.findOneBy({ profileId: profileId }); if (!familyFather) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); diff --git a/src/controllers/ProfileFamilyMotherController.ts b/src/controllers/ProfileFamilyMotherController.ts index 923ee636..7f1197df 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().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFF + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); 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); //ไม่แน่ใจOFF + await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profileId); const familyMother = await this.ProfileFamilyMother.findOneBy({ profileId: profileId }); if (!familyMother) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");