role เมนู ลูกจ้างชั่วคราว

This commit is contained in:
AdisakKanthawilang 2024-08-26 15:57:09 +07:00
parent 6f053d2c70
commit 877a70ef3d
22 changed files with 109 additions and 63 deletions

View file

@ -69,7 +69,8 @@ export class ProfileAddressEmployeeTempController extends Controller {
* *
*/ */
@Get("{profileEmployeeId}") @Get("{profileEmployeeId}")
public async detailProfileAddress(@Path() profileEmployeeId: string) { public async detailProfileAddress(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const getProfileAddress = await this.profileEmployeeRepo.findOne({ const getProfileAddress = await this.profileEmployeeRepo.findOne({
where: { id: profileEmployeeId }, where: { id: profileEmployeeId },
select: [ select: [
@ -99,6 +100,7 @@ export class ProfileAddressEmployeeTempController extends Controller {
*/ */
@Get("history/user") @Get("history/user")
public async getProfileAddressHistoryUser(@Request() request: RequestWithUser) { 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 }); const profile = await this.profileEmployeeRepo.findOneBy({ keycloak: request.user.sub });
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
@ -140,7 +142,8 @@ export class ProfileAddressEmployeeTempController extends Controller {
* *
*/ */
@Get("history/{profileId}") @Get("history/{profileId}")
public async getProfileAddressHistory(@Path() profileId: string) { public async getProfileAddressHistory(@Path() profileId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
const record = await this.profileAddressHistoryRepo.find({ const record = await this.profileAddressHistoryRepo.find({
where: { profileEmployeeId: profileId }, where: { profileEmployeeId: profileId },
relations: { relations: {

View file

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

View file

@ -15,7 +15,8 @@ export class ProfileAvatarEmployeeTempController extends Controller {
private avatarRepository = AppDataSource.getRepository(ProfileAvatar); private avatarRepository = AppDataSource.getRepository(ProfileAvatar);
@Get("{profileEmployeeId}") @Get("{profileEmployeeId}")
public async getAvatarEmployee(@Path() profileEmployeeId: string) { public async getAvatarEmployee(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
const lists = await this.avatarRepository.find({ const lists = await this.avatarRepository.find({
where: { profileEmployeeId }, where: { profileEmployeeId },
}); });
@ -23,7 +24,8 @@ export class ProfileAvatarEmployeeTempController extends Controller {
} }
@Get("select/{profileEmployeeId}/{id}") @Get("select/{profileEmployeeId}/{id}")
public async selectAvatarEmployee(@Path() profileEmployeeId: string, @Path() id: string) { public async selectAvatarEmployee(@Path() profileEmployeeId: string, @Path() id: string, @Request() req: RequestWithUser) {
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ตสTEMP
const result = await this.avatarRepository.findOneBy({ id: id }); const result = await this.avatarRepository.findOneBy({ id: id });
if (!result) { if (!result) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1058,7 +1058,7 @@ export class ProfileEmployeeController extends Controller {
*/ */
@Get("{id}") @Get("{id}")
async detailProfile(@Path() id: string, @Request() req: RequestWithUser) { async detailProfile(@Path() id: string, @Request() req: RequestWithUser) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id); // await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id);//ตส
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
relations: { relations: {
posLevel: true, posLevel: true,

View file

@ -116,7 +116,8 @@ export class ProfileEmployeeTempController extends Controller {
* @param {string} id Id * @param {string} id Id
*/ */
@Get("kp7-short/{id}") @Get("kp7-short/{id}")
async kp7ShortById(@Path() id: string) { async kp7ShortById(@Path() id: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const orgRevision = await this.orgRevisionRepo.findOne({ const orgRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true }, where: { orgRevisionIsCurrent: true },
}); });
@ -239,7 +240,8 @@ export class ProfileEmployeeTempController extends Controller {
* @param {string} id Id * @param {string} id Id
*/ */
@Get("kk1/{id}") @Get("kk1/{id}")
public async getKk1Employee(@Path() id: string) { public async getKk1Employee(@Path() id: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const profiles = await this.profileRepo.findOne({ const profiles = await this.profileRepo.findOne({
// select: [ // select: [
// "citizenId", // "citizenId",
@ -1053,7 +1055,7 @@ export class ProfileEmployeeTempController extends Controller {
* @param {string} id Id * @param {string} id Id
*/ */
@Get("{id}") @Get("{id}")
async detailProfile(@Path() id: string) { async detailProfile(@Path() id: string) {//ตสTEMP
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
relations: { relations: {
posLevel: true, posLevel: true,
@ -1306,7 +1308,8 @@ export class ProfileEmployeeTempController extends Controller {
} }
@Get("history/{id}") @Get("history/{id}")
async getProfileHistory(@Path() id: string) { async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
const profile = await this.profileHistoryRepo.find({ const profile = await this.profileHistoryRepo.find({
relations: { relations: {
posLevel: true, posLevel: true,
@ -2066,7 +2069,7 @@ export class ProfileEmployeeTempController extends Controller {
* @param {string} id Id * @param {string} id Id
*/ */
@Put("position/{id}") @Put("position/{id}")
async positionProfileEmployee( async positionProfileEmployee(//ตสTEMP
@Request() request: RequestWithUser, @Request() request: RequestWithUser,
@Path() id: string, @Path() id: string,
@Body() body: UpdatePositionTempProfileEmployee, @Body() body: UpdatePositionTempProfileEmployee,
@ -2198,7 +2201,7 @@ export class ProfileEmployeeTempController extends Controller {
* @param {string} id Id * @param {string} id Id
*/ */
@Put("citizenId/{id}") @Put("citizenId/{id}")
async checkCitizenIdProfile( async checkCitizenIdProfile(//ตสTEMP
@Path() id: string, @Path() id: string,
@Body() @Body()
requestBody: { citizenId: string }, requestBody: { citizenId: string },
@ -2549,7 +2552,7 @@ export class ProfileEmployeeTempController extends Controller {
* *
*/ */
@Get("keycloak/position/{revisionId}") @Get("keycloak/position/{revisionId}")
async getProfileByKeycloakByRevision( async getProfileByKeycloakByRevision(//ตสTEMP
@Path() revisionId: string, @Path() revisionId: string,
@Request() request: { user: Record<string, any> }, @Request() request: { user: Record<string, any> },
) { ) {
@ -2649,7 +2652,7 @@ export class ProfileEmployeeTempController extends Controller {
* @summary * @summary
* *
*/ */
@Get("profileid/retire/{year}") @Get("profileid/retire/{year}")//ตสTEMP
async getProfileByRetireYear(@Path() year: number) { async getProfileByRetireYear(@Path() year: number) {
const profiles = await this.profileRepo const profiles = await this.profileRepo
.createQueryBuilder("profileEmployee") .createQueryBuilder("profileEmployee")
@ -2842,7 +2845,7 @@ export class ProfileEmployeeTempController extends Controller {
* *
* @param {string} id Id * @param {string} id Id
*/ */
@Post("leave/{id}") @Post("leave/{id}")//ตสTEMP
async updateLeaveUser( async updateLeaveUser(
@Path() id: string, @Path() id: string,
@Body() @Body()
@ -2877,7 +2880,7 @@ export class ProfileEmployeeTempController extends Controller {
* *
* @param {string} profileEmployeeId profileEmployeeId * @param {string} profileEmployeeId profileEmployeeId
*/ */
@Put("information/{profileEmployeeId}") @Put("information/{profileEmployeeId}")//ตสTEMP
async ProfileEmployeeInformation( async ProfileEmployeeInformation(
@Request() request: RequestWithUser, @Request() request: RequestWithUser,
@Path() profileEmployeeId: string, @Path() profileEmployeeId: string,
@ -2909,7 +2912,7 @@ export class ProfileEmployeeTempController extends Controller {
* *
* @param {string} profileEmployeeId profileEmployeeId * @param {string} profileEmployeeId profileEmployeeId
*/ */
@Get("information/{profileEmployeeId}") @Get("information/{profileEmployeeId}")//ตสTEMP
async getInformationById(@Path() profileEmployeeId: string) { async getInformationById(@Path() profileEmployeeId: string) {
const profileInformation = await this.profileRepo.findOne({ const profileInformation = await this.profileRepo.findOne({
where: { id: profileEmployeeId }, where: { id: profileEmployeeId },
@ -2939,7 +2942,7 @@ export class ProfileEmployeeTempController extends Controller {
* *
* @param {string} profileEmployeeId profileEmployeeId * @param {string} profileEmployeeId profileEmployeeId
*/ */
@Get("information/history/{profileEmployeeId}") @Get("information/history/{profileEmployeeId}")//ตสTEMP
async getInformationHistory(@Path() profileEmployeeId: string) { async getInformationHistory(@Path() profileEmployeeId: string) {
const profileInformation = await this.profileRepo.find({ const profileInformation = await this.profileRepo.find({
relations: { relations: {
@ -2980,7 +2983,7 @@ export class ProfileEmployeeTempController extends Controller {
* *
* @param {string} profileEmployeeId profileEmployeeId * @param {string} profileEmployeeId profileEmployeeId
*/ */
@Get("employment/{profileEmployeeId}") @Get("employment/{profileEmployeeId}")//ตสTEMP
async ProfileEmployeeEmployment(@Path() profileEmployeeId: string) { async ProfileEmployeeEmployment(@Path() profileEmployeeId: string) {
const employment = await this.employmentRepository.find({ const employment = await this.employmentRepository.find({
where: { profileEmployeeId: profileEmployeeId }, where: { profileEmployeeId: profileEmployeeId },
@ -3001,7 +3004,7 @@ export class ProfileEmployeeTempController extends Controller {
* *
* @param {string} id Id * @param {string} id Id
*/ */
@Get("employment/id/{id}") @Get("employment/id/{id}")//ตสTEMP
async GetEmploymentById(@Path() id: string) { async GetEmploymentById(@Path() id: string) {
const employment = await this.employmentRepository.findOne({ const employment = await this.employmentRepository.findOne({
where: { id: id }, where: { id: id },
@ -3016,7 +3019,7 @@ export class ProfileEmployeeTempController extends Controller {
* *
* @param {string} id Id * @param {string} id Id
*/ */
@Get("employment/history/{id}") @Get("employment/history/{id}")//ตสTEMP
async GetHistoryEmploymentById(@Path() id: string) { async GetHistoryEmploymentById(@Path() id: string) {
const employmentHistory = await this.employmentHistoryRepository.find({ const employmentHistory = await this.employmentHistoryRepository.find({
where: { profileEmployeeEmploymentId: id }, where: { profileEmployeeEmploymentId: id },
@ -3032,7 +3035,7 @@ export class ProfileEmployeeTempController extends Controller {
* *
* @param {string} profileEmployeeId profileEmployeeId * @param {string} profileEmployeeId profileEmployeeId
*/ */
@Post("employment/{profileEmployeeId}") @Post("employment/{profileEmployeeId}")//ตสTEMP
async CreateEmployment( async CreateEmployment(
@Path() profileEmployeeId: string, @Path() profileEmployeeId: string,
@Body() body: CreateEmploymentProfileEmployee, @Body() body: CreateEmploymentProfileEmployee,
@ -3071,7 +3074,7 @@ export class ProfileEmployeeTempController extends Controller {
* *
* @param {string} id Id * @param {string} id Id
*/ */
@Delete("employment/{id}") @Delete("employment/{id}")//ตสTEMP
async DeleteEmployment(@Path() id: string) { async DeleteEmployment(@Path() id: string) {
await this.employmentHistoryRepository.delete({ await this.employmentHistoryRepository.delete({
profileEmployeeEmploymentId: id, profileEmployeeEmploymentId: id,
@ -3091,7 +3094,7 @@ export class ProfileEmployeeTempController extends Controller {
* *
* @param {string} id Id * @param {string} id Id
*/ */
@Put("employment/{id}") @Put("employment/{id}")//ตสTEMP
async UpdateEmployment( async UpdateEmployment(
@Request() request: RequestWithUser, @Request() request: RequestWithUser,
@Path() id: string, @Path() id: string,
@ -3124,7 +3127,7 @@ export class ProfileEmployeeTempController extends Controller {
* @summary ORG_038 - (ADMIN) # * @summary ORG_038 - (ADMIN) #
* *
*/ */
@Post("report") @Post("report")//ตสTEMP
async sendReport(@Request() request: RequestWithUser, @Body() requestBody: { id: string[] }) { async sendReport(@Request() request: RequestWithUser, @Body() requestBody: { id: string[] }) {
const profiles = await this.profileRepo.find({ where: { id: In(requestBody.id) } }); const profiles = await this.profileRepo.find({ where: { id: In(requestBody.id) } });
@ -3148,7 +3151,7 @@ export class ProfileEmployeeTempController extends Controller {
* @summary ORG_038 - (ADMIN) # * @summary ORG_038 - (ADMIN) #
* *
*/ */
@Post("report/resume") @Post("report/resume")//ตสTEMP
async doneReport( async doneReport(
@Body() @Body()
body: { body: {
@ -3213,7 +3216,7 @@ export class ProfileEmployeeTempController extends Controller {
* @summary keycloak * @summary keycloak
* *
*/ */
@Post("search-personal-no-keycloak") @Post("search-personal-no-keycloak")//ตสTEMP
async getProfileBySearchKeywordNoKeyCloak( async getProfileBySearchKeywordNoKeyCloak(
@Query("page") page: number = 1, @Query("page") page: number = 1,
@Query("pageSize") pageSize: number = 10, @Query("pageSize") pageSize: number = 10,
@ -3379,7 +3382,7 @@ export class ProfileEmployeeTempController extends Controller {
* @summary ORG_065 - profileid (ADMIN) #70 * @summary ORG_065 - profileid (ADMIN) #70
* *
*/ */
@Get("profileid/position/{id}") @Get("profileid/position/{id}")//ตสTEMP
async getProfileByProfileid( async getProfileByProfileid(
@Request() request: { user: Record<string, any> }, @Request() request: { user: Record<string, any> },
@Path() id: string, @Path() id: string,

View file

@ -77,7 +77,8 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller {
profileEmployeeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", profileEmployeeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
}, },
}) })
public async getFamilyCouple(@Path() profileEmployeeId: string) { public async getFamilyCouple(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
where: { id: profileEmployeeId }, where: { id: profileEmployeeId },
}); });
@ -112,6 +113,7 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller {
*/ */
@Get("history/user") @Get("history/user")
public async familyCoupleHistoryUser(@Request() request: RequestWithUser) { public async familyCoupleHistoryUser(@Request() request: RequestWithUser) {
await new permission().PermissionGet(request, "SYS_REGISTRY_TEMP");
const profile = await this.profileRepo.findOneBy({ keycloak: request.user.sub }); const profile = await this.profileRepo.findOneBy({ keycloak: request.user.sub });
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
@ -176,7 +178,8 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller {
}, },
], ],
}) })
public async familyCoupleHistory(@Path() profileEmployeeId: string) { public async familyCoupleHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
where: { id: profileEmployeeId }, where: { id: profileEmployeeId },
}); });

View file

@ -73,7 +73,8 @@ export class ProfileFamilyFatherEmployeeTempController extends Controller {
profileEmployeeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", profileEmployeeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
}, },
}) })
public async getFamilyFather(@Path() profileEmployeeId: string) { public async getFamilyFather(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
where: { id: profileEmployeeId }, where: { id: profileEmployeeId },
}); });
@ -164,7 +165,8 @@ export class ProfileFamilyFatherEmployeeTempController extends Controller {
}, },
], ],
}) })
public async familyFatherHistory(@Path() profileEmployeeId: string) { public async familyFatherHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
where: { id: profileEmployeeId }, where: { id: profileEmployeeId },
}); });

View file

@ -73,7 +73,8 @@ export class ProfileFamilyMotherEmployeeTempController extends Controller {
profileEmployeeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", profileEmployeeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
}, },
}) })
public async getFamilyMother(@Path() profileEmployeeId: string) { public async getFamilyMother(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
where: { id: profileEmployeeId }, where: { id: profileEmployeeId },
}); });
@ -164,7 +165,8 @@ export class ProfileFamilyMotherEmployeeTempController extends Controller {
}, },
], ],
}) })
public async familyMotherHistory(@Path() profileEmployeeId: string) { public async familyMotherHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
where: { id: profileEmployeeId }, where: { id: profileEmployeeId },
}); });

View file

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

View file

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

View file

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

View file

@ -49,7 +49,8 @@ export class ProfileLeaveEmployeeTempController extends Controller {
} }
@Get("{profileId}") @Get("{profileId}")
public async getLeave(@Path() profileId: string) { public async getLeave(@Path() profileId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
const record = await this.leaveRepo.find({ const record = await this.leaveRepo.find({
relations: { leaveType: true }, relations: { leaveType: true },
where: { profileEmployeeId: profileId }, where: { profileEmployeeId: profileId },
@ -58,7 +59,8 @@ export class ProfileLeaveEmployeeTempController extends Controller {
} }
@Get("history/{leaveId}") @Get("history/{leaveId}")
public async leaveHistory(@Path() leaveId: string) { public async leaveHistory(@Path() leaveId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
const record = await this.leaveHistoryRepo.find({ const record = await this.leaveHistoryRepo.find({
relations: { leaveType: true }, relations: { leaveType: true },
where: { profileLeaveId: leaveId }, where: { profileLeaveId: leaveId },

View file

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

View file

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

View file

@ -48,7 +48,8 @@ export class ProfileSalaryEmployeeTempController extends Controller {
} }
@Get("{profileId}") @Get("{profileId}")
public async getSalaryEmployee(@Path() profileId: string) { public async getSalaryEmployee(@Path() profileId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
const record = await this.salaryRepo.find({ const record = await this.salaryRepo.find({
where: { profileEmployeeId: profileId }, where: { profileEmployeeId: profileId },
order: { order: "ASC" }, order: { order: "ASC" },
@ -57,7 +58,8 @@ export class ProfileSalaryEmployeeTempController extends Controller {
} }
@Get("history/{salaryId}") @Get("history/{salaryId}")
public async salaryHistory(@Path() salaryId: string) { public async salaryHistory(@Path() salaryId: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
const record = await this.salaryHistoryRepo.findBy({ const record = await this.salaryHistoryRepo.findBy({
profileSalaryId: salaryId, profileSalaryId: salaryId,
}); });

View file

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