recheck เมนู ลูกจ้างชั่วคราว (list to get)

This commit is contained in:
AdisakKanthawilang 2024-08-29 09:49:56 +07:00
parent 271e6964b3
commit 51eaf6b976
19 changed files with 37 additions and 38 deletions

View file

@ -74,7 +74,7 @@ export class ProfileAbilityEmployeeTempController extends Controller {
],
})
public async detailProfileAbility(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const getProfileAbilityId = await this.profileAbilityRepo.findBy({ profileEmployeeId });
if (!getProfileAbilityId) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
@ -124,7 +124,7 @@ export class ProfileAbilityEmployeeTempController extends Controller {
public async getProfileAbilityHistory(@Path() abilityId: string, @Request() req: RequestWithUser) {
const _record = await this.profileAbilityRepo.findOneBy({ id: abilityId });
if (_record) {
await new permission().PermissionDelete(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
}
const record = await this.profileAbilityHistoryRepo.findBy({

View file

@ -148,7 +148,7 @@ export class ProfileAddressEmployeeTempController extends Controller {
@Path() profileId: string,
@Request() req: RequestWithUser,
) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.profileAddressHistoryRepo.find({
where: { profileEmployeeId: profileId },
relations: {

View file

@ -79,7 +79,7 @@ export class ProfileAssessmentsEmployeeTempController extends Controller {
],
})
public async detailProfileAssessments(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const getProfileAssessments = await this.profileAssessmentsRepository.findBy({
profileEmployeeId,
});
@ -133,7 +133,7 @@ export class ProfileAssessmentsEmployeeTempController extends Controller {
],
})
public async getProfileAssessmentsHistory(@Path() assessmentId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.profileAssessmentsHistoryRepository.findBy({
profileAssessmentId: assessmentId,
});

View file

@ -19,7 +19,7 @@ export class ProfileAvatarEmployeeTempController extends Controller {
@Path() profileEmployeeId: string,
@Request() req: RequestWithUser,
) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const lists = await this.avatarRepository.find({
where: { profileEmployeeId },
});
@ -28,7 +28,7 @@ export class ProfileAvatarEmployeeTempController extends Controller {
@Get("profileEmployeeId/{id}")
async getProfile(@Path() id: string, @Request() req: RequestWithUser) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_TEMP", id);
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const profile = await this.profileRepository.findOne({
select: ["id", "avatar", "avatarName"],
where: { id },

View file

@ -68,7 +68,7 @@ export class ProfileCertificateEmployeeTempController extends Controller {
],
})
public async getCertificate(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.certificateRepo.findBy({ profileEmployeeId });
return new HttpSuccess(record);
}
@ -111,7 +111,7 @@ export class ProfileCertificateEmployeeTempController extends Controller {
],
})
public async certificateHistory(@Path() certificateId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.certificateHistoryRepo.findBy({
profileCertificateId: certificateId,
});

View file

@ -65,7 +65,7 @@ export class ProfileChangeNameEmployeeTempController extends Controller {
],
})
public async getChangeName(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const lists = await this.changeNameRepository.find({
where: { profileEmployeeId: profileEmployeeId },
select: ["id", "prefix", "firstName", "lastName", "status"],
@ -100,7 +100,7 @@ export class ProfileChangeNameEmployeeTempController extends Controller {
],
})
public async changeNameHistory(@Path() changeNameId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.changeNameHistoryRepository.find({
where: { profileChangeNameId: changeNameId },
select: [

View file

@ -50,7 +50,7 @@ export class ProfileChildrenEmployeeTempController extends Controller {
@Get("{profileEmployeeId}")
public async getChildren(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const lists = await this.childrenRepository.find({
where: { profileEmployeeId: profileEmployeeId },
});
@ -59,7 +59,7 @@ export class ProfileChildrenEmployeeTempController extends Controller {
@Get("history/{childrenId}")
public async childrenHistory(@Path() childrenId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.childrenHistoryRepository.find({
where: { profileChildrenId: childrenId },
order: { createdAt: "DESC" },

View file

@ -73,7 +73,7 @@ export class ProfileDisciplineEmployeeTempController extends Controller {
],
})
public async getDiscipline(@Path() profileId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const lists = await this.disciplineRepository.find({
where: { profileEmployeeId: profileId },
select: [
@ -113,7 +113,7 @@ export class ProfileDisciplineEmployeeTempController extends Controller {
@Get("history/{disciplineId}")
public async disciplineHistory(@Path() disciplineId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.disciplineHistoryRepository.find({
where: { profileDisciplineId: disciplineId },
select: [

View file

@ -52,7 +52,7 @@ export class ProfileDutyEmployeeTempController extends Controller {
@Get("{profileId}")
public async getDuty(@Path() profileId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const lists = await this.dutyRepository.find({
where: { profileEmployeeId: profileId },
select: [
@ -70,7 +70,7 @@ export class ProfileDutyEmployeeTempController extends Controller {
@Get("history/{dutyId}")
public async dutyHistory(@Path() dutyId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.dutyHistoryRepository.find({
where: { profileDutyId: dutyId },
select: [

View file

@ -92,7 +92,7 @@ export class ProfileEducationsEmployeeTempController extends Controller {
],
})
public async detailProfileEducation(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const getProfileEducation = await this.profileEducationRepo.find({
where: { profileEmployeeId: profileEmployeeId },
});
@ -170,7 +170,7 @@ export class ProfileEducationsEmployeeTempController extends Controller {
],
})
public async getProfileEducationHistory(@Path() educationId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.profileEducationHistoryRepo.findBy({
profileEducationId: educationId,
});

View file

@ -578,7 +578,7 @@ export class ProfileEmployeeTempController extends Controller {
*/
@Post()
async createProfile(@Body() body: CreateProfileEmployee, @Request() request: RequestWithUser) {
await new permission().PermissionCreate(request, "SYS_REGISTRY_TEMP");
await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");
if (await this.profileRepo.findOneBy({ citizenId: body.citizenId })) {
throw new HttpError(
HttpStatus.INTERNAL_SERVER_ERROR,
@ -1325,7 +1325,7 @@ export class ProfileEmployeeTempController extends Controller {
@Get("history/{id}")
async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) {
// await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
const profile = await this.profileHistoryRepo.find({
relations: {
posLevel: true,
@ -2672,7 +2672,7 @@ export class ProfileEmployeeTempController extends Controller {
*/
@Get("profileid/retire/{year}")
async getProfileByRetireYear(@Path() year: number, @Request() req: RequestWithUser) {
// await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
const profiles = await this.profileRepo
.createQueryBuilder("profileEmployee")
.leftJoinAndSelect("profileEmployee.posLevel", "posLevel")
@ -2966,7 +2966,7 @@ export class ProfileEmployeeTempController extends Controller {
*/
@Get("information/history/{profileEmployeeId}")
async getInformationHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const profileInformation = await this.profileRepo.find({
relations: {
information_histories: true,
@ -3011,7 +3011,7 @@ export class ProfileEmployeeTempController extends Controller {
@Path() profileEmployeeId: string,
@Request() req: RequestWithUser,
) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const employment = await this.employmentRepository.find({
where: { profileEmployeeId: profileEmployeeId },
order: { createdAt: "ASC" },

View file

@ -344,7 +344,7 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
@Get("history/{profileEmployeeId}")
@Example({})
public async govHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.govRepo.find({
order: { lastUpdatedAt: "DESC" },
where: { profileEmployeeId: profileEmployeeId },

View file

@ -69,7 +69,7 @@ export class ProfileHonorEmployeeTempController extends Controller {
],
})
public async getHonor(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.honorRepo.findBy({ profileEmployeeId });
return new HttpSuccess(record);
}
@ -81,7 +81,6 @@ export class ProfileHonorEmployeeTempController extends Controller {
*/
@Get("history/user")
public async honorHistoryUser(@Request() request: RequestWithUser) {
await new permission().PermissionGet(request, "SYS_REGISTRY_TEMP");
const profile = await this.profileEmployeeRepo.findOneBy({ keycloak: request.user.sub });
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
@ -136,7 +135,7 @@ export class ProfileHonorEmployeeTempController extends Controller {
],
})
public async honorHistory(@Path() honorId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.honorHistoryRepo.findBy({
profileHonorId: honorId,
});

View file

@ -84,7 +84,7 @@ export class ProfileInsigniaEmployeeTempController extends Controller {
],
})
public async getInsignia(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.insigniaRepo.find({
relations: {
insignia: {
@ -152,7 +152,7 @@ export class ProfileInsigniaEmployeeTempController extends Controller {
],
})
public async getInsigniaHistory(@Path() InsigniaId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.insigniaHistoryRepo.find({
relations: {
insignia: {

View file

@ -50,7 +50,7 @@ export class ProfileLeaveEmployeeTempController extends Controller {
@Get("{profileId}")
public async getLeave(@Path() profileId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.leaveRepo.find({
relations: { leaveType: true },
where: { profileEmployeeId: profileId },

View file

@ -47,7 +47,7 @@ export class ProfileNopaidEmployeeTempController extends Controller {
@Get("{profileId}")
public async getNopaid(@Path() profileId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const lists = await this.nopaidRepository.find({
where: { profileEmployeeId: profileId },
});
@ -56,7 +56,7 @@ export class ProfileNopaidEmployeeTempController extends Controller {
@Get("history/{nopaidId}")
public async nopaidHistory(@Path() nopaidId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.nopaidHistoryRepository.find({
where: { profileNopaidId: nopaidId },
order: { createdAt: "DESC" },

View file

@ -47,7 +47,7 @@ export class ProfileOtherEmployeeTempController extends Controller {
@Get("{profileId}")
public async getOther(@Path() profileId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const lists = await this.otherRepository.find({
where: { profileEmployeeId: profileId },
});
@ -56,7 +56,7 @@ export class ProfileOtherEmployeeTempController extends Controller {
@Get("history/{otherId}")
public async otherHistory(@Path() otherId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.otherHistoryRepository.find({
where: { profileOtherId: otherId },
order: { createdAt: "DESC" },

View file

@ -69,7 +69,7 @@ export class ProfileSalaryEmployeeTempController extends Controller {
@Get("history/{salaryId}")
public async salaryHistory(@Path() salaryId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.salaryHistoryRepo.findBy({
profileSalaryId: salaryId,
});

View file

@ -75,7 +75,7 @@ export class ProfileTrainingEmployeeTempController extends Controller {
],
})
public async getTraining(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.trainingRepo.findBy({ profileEmployeeId });
return new HttpSuccess(record);
}
@ -132,7 +132,7 @@ export class ProfileTrainingEmployeeTempController extends Controller {
],
})
public async trainingHistory(@Path() trainingId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.trainingHistoryRepo.findBy({
profileTrainingId: trainingId,
});