role เมนู ลูกจ้างชั่วคราว
This commit is contained in:
parent
6f053d2c70
commit
877a70ef3d
22 changed files with 109 additions and 63 deletions
|
|
@ -69,7 +69,8 @@ export class ProfileAddressEmployeeTempController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Get("{profileEmployeeId}")
|
||||
public async detailProfileAddress(@Path() profileEmployeeId: string) {
|
||||
public async detailProfileAddress(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const getProfileAddress = await this.profileEmployeeRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
select: [
|
||||
|
|
@ -99,6 +100,7 @@ export class ProfileAddressEmployeeTempController extends Controller {
|
|||
*/
|
||||
@Get("history/user")
|
||||
public async getProfileAddressHistoryUser(@Request() request: RequestWithUser) {
|
||||
// await new permission().PermissionGet(request, "SYS_REGISTRY_TEMP");//ตสTEMP
|
||||
const profile = await this.profileEmployeeRepo.findOneBy({ keycloak: request.user.sub });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
|
|
@ -140,7 +142,8 @@ export class ProfileAddressEmployeeTempController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Get("history/{profileId}")
|
||||
public async getProfileAddressHistory(@Path() profileId: string) {
|
||||
public async getProfileAddressHistory(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.profileAddressHistoryRepo.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
relations: {
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@ export class ProfileAssessmentsEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async detailProfileAssessments(@Path() profileEmployeeId: string) {
|
||||
public async detailProfileAssessments(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const getProfileAssessments = await this.profileAssessmentsRepository.findBy({
|
||||
profileEmployeeId,
|
||||
});
|
||||
|
|
@ -131,7 +132,8 @@ export class ProfileAssessmentsEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async getProfileAssessmentsHistory(@Path() assessmentId: string) {
|
||||
public async getProfileAssessmentsHistory(@Path() assessmentId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.profileAssessmentsHistoryRepository.findBy({
|
||||
profileAssessmentId: assessmentId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ export class ProfileAvatarEmployeeTempController extends Controller {
|
|||
private avatarRepository = AppDataSource.getRepository(ProfileAvatar);
|
||||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getAvatarEmployee(@Path() profileEmployeeId: string) {
|
||||
public async getAvatarEmployee(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const lists = await this.avatarRepository.find({
|
||||
where: { profileEmployeeId },
|
||||
});
|
||||
|
|
@ -23,7 +24,8 @@ export class ProfileAvatarEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("select/{profileEmployeeId}/{id}")
|
||||
public async selectAvatarEmployee(@Path() profileEmployeeId: string, @Path() id: string) {
|
||||
public async selectAvatarEmployee(@Path() profileEmployeeId: string, @Path() id: string, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ตสTEMP
|
||||
const result = await this.avatarRepository.findOneBy({ id: id });
|
||||
if (!result) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ export class ProfileCertificateEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async getCertificate(@Path() profileEmployeeId: string) {
|
||||
public async getCertificate(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.certificateRepo.findBy({ profileEmployeeId });
|
||||
return new HttpSuccess(record);
|
||||
}
|
||||
|
|
@ -109,7 +110,8 @@ export class ProfileCertificateEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async certificateHistory(@Path() certificateId: string) {
|
||||
public async certificateHistory(@Path() certificateId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.certificateHistoryRepo.findBy({
|
||||
profileCertificateId: certificateId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ export class ProfileChangeNameEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async getChangeName(@Path() profileEmployeeId: string) {
|
||||
public async getChangeName(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const lists = await this.changeNameRepository.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
select: ["id", "prefix", "firstName", "lastName", "status"],
|
||||
|
|
@ -98,7 +99,8 @@ export class ProfileChangeNameEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async changeNameHistory(@Path() changeNameId: string) {
|
||||
public async changeNameHistory(@Path() changeNameId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.changeNameHistoryRepository.find({
|
||||
where: { profileChangeNameId: changeNameId },
|
||||
select: [
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ export class ProfileChildrenEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getChildren(@Path() profileEmployeeId: string) {
|
||||
public async getChildren(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const lists = await this.childrenRepository.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -57,7 +58,8 @@ export class ProfileChildrenEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("history/{childrenId}")
|
||||
public async childrenHistory(@Path() childrenId: string) {
|
||||
public async childrenHistory(@Path() childrenId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.childrenHistoryRepository.find({
|
||||
where: { profileChildrenId: childrenId },
|
||||
order: { createdAt: "DESC" },
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@ export class ProfileDisciplineEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async getDiscipline(@Path() profileId: string) {
|
||||
public async getDiscipline(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const lists = await this.disciplineRepository.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
select: [
|
||||
|
|
@ -91,7 +92,8 @@ export class ProfileDisciplineEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("history/{disciplineId}")
|
||||
public async disciplineHistory(@Path() disciplineId: string) {
|
||||
public async disciplineHistory(@Path() disciplineId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.disciplineHistoryRepository.find({
|
||||
where: { profileDisciplineId: disciplineId },
|
||||
select: [
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ export class ProfileDutyEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("{profileId}")
|
||||
public async getDuty(@Path() profileId: string) {
|
||||
public async getDuty(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const lists = await this.dutyRepository.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
select: [
|
||||
|
|
@ -68,7 +69,8 @@ export class ProfileDutyEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("history/{dutyId}")
|
||||
public async dutyHistory(@Path() dutyId: string) {
|
||||
public async dutyHistory(@Path() dutyId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.dutyHistoryRepository.find({
|
||||
where: { profileDutyId: dutyId },
|
||||
select: [
|
||||
|
|
|
|||
|
|
@ -91,7 +91,8 @@ export class ProfileEducationsEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async detailProfileEducation(@Path() profileEmployeeId: string) {
|
||||
public async detailProfileEducation(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const getProfileEducation = await this.profileEducationRepo.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -168,7 +169,8 @@ export class ProfileEducationsEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async getProfileEducationHistory(@Path() educationId: string) {
|
||||
public async getProfileEducationHistory(@Path() educationId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.profileEducationHistoryRepo.findBy({
|
||||
profileEducationId: educationId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1058,7 +1058,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
*/
|
||||
@Get("{id}")
|
||||
async detailProfile(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id);
|
||||
// await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id);//ตส
|
||||
const profile = await this.profileRepo.findOne({
|
||||
relations: {
|
||||
posLevel: true,
|
||||
|
|
|
|||
|
|
@ -116,7 +116,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @param {string} id Id โปรไฟล์
|
||||
*/
|
||||
@Get("kp7-short/{id}")
|
||||
async kp7ShortById(@Path() id: string) {
|
||||
async kp7ShortById(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const orgRevision = await this.orgRevisionRepo.findOne({
|
||||
where: { orgRevisionIsCurrent: true },
|
||||
});
|
||||
|
|
@ -239,7 +240,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @param {string} id Id โปรไฟล์
|
||||
*/
|
||||
@Get("kk1/{id}")
|
||||
public async getKk1Employee(@Path() id: string) {
|
||||
public async getKk1Employee(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profiles = await this.profileRepo.findOne({
|
||||
// select: [
|
||||
// "citizenId",
|
||||
|
|
@ -1053,7 +1055,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @param {string} id Id ทะเบียนประวัติ
|
||||
*/
|
||||
@Get("{id}")
|
||||
async detailProfile(@Path() id: string) {
|
||||
async detailProfile(@Path() id: string) {//ตสTEMP
|
||||
const profile = await this.profileRepo.findOne({
|
||||
relations: {
|
||||
posLevel: true,
|
||||
|
|
@ -1306,7 +1308,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("history/{id}")
|
||||
async getProfileHistory(@Path() id: string) {
|
||||
async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileHistoryRepo.find({
|
||||
relations: {
|
||||
posLevel: true,
|
||||
|
|
@ -2066,7 +2069,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @param {string} id Id ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Put("position/{id}")
|
||||
async positionProfileEmployee(
|
||||
async positionProfileEmployee(//ตสTEMP
|
||||
@Request() request: RequestWithUser,
|
||||
@Path() id: string,
|
||||
@Body() body: UpdatePositionTempProfileEmployee,
|
||||
|
|
@ -2198,7 +2201,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @param {string} id Id ทะเบียนประวัติ
|
||||
*/
|
||||
@Put("citizenId/{id}")
|
||||
async checkCitizenIdProfile(
|
||||
async checkCitizenIdProfile(//ตสTEMP
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: { citizenId: string },
|
||||
|
|
@ -2549,7 +2552,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Get("keycloak/position/{revisionId}")
|
||||
async getProfileByKeycloakByRevision(
|
||||
async getProfileByKeycloakByRevision(//ตสTEMP
|
||||
@Path() revisionId: string,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
|
|
@ -2649,7 +2652,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @summary ข้อมูลบุลคลที่มีอายุเกษียณราชการตามปี
|
||||
*
|
||||
*/
|
||||
@Get("profileid/retire/{year}")
|
||||
@Get("profileid/retire/{year}")//ตสTEMP
|
||||
async getProfileByRetireYear(@Path() year: number) {
|
||||
const profiles = await this.profileRepo
|
||||
.createQueryBuilder("profileEmployee")
|
||||
|
|
@ -2842,7 +2845,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} id Id ทะเบียนประวัติ
|
||||
*/
|
||||
@Post("leave/{id}")
|
||||
@Post("leave/{id}")//ตสTEMP
|
||||
async updateLeaveUser(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
|
|
@ -2877,7 +2880,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Put("information/{profileEmployeeId}")
|
||||
@Put("information/{profileEmployeeId}")//ตสTEMP
|
||||
async ProfileEmployeeInformation(
|
||||
@Request() request: RequestWithUser,
|
||||
@Path() profileEmployeeId: string,
|
||||
|
|
@ -2909,7 +2912,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Get("information/{profileEmployeeId}")
|
||||
@Get("information/{profileEmployeeId}")//ตสTEMP
|
||||
async getInformationById(@Path() profileEmployeeId: string) {
|
||||
const profileInformation = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
|
|
@ -2939,7 +2942,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Get("information/history/{profileEmployeeId}")
|
||||
@Get("information/history/{profileEmployeeId}")//ตสTEMP
|
||||
async getInformationHistory(@Path() profileEmployeeId: string) {
|
||||
const profileInformation = await this.profileRepo.find({
|
||||
relations: {
|
||||
|
|
@ -2980,7 +2983,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Get("employment/{profileEmployeeId}")
|
||||
@Get("employment/{profileEmployeeId}")//ตสTEMP
|
||||
async ProfileEmployeeEmployment(@Path() profileEmployeeId: string) {
|
||||
const employment = await this.employmentRepository.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
|
|
@ -3001,7 +3004,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} id Id ข้อมูลการจ้าง
|
||||
*/
|
||||
@Get("employment/id/{id}")
|
||||
@Get("employment/id/{id}")//ตสTEMP
|
||||
async GetEmploymentById(@Path() id: string) {
|
||||
const employment = await this.employmentRepository.findOne({
|
||||
where: { id: id },
|
||||
|
|
@ -3016,7 +3019,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} id Id ข้อมูลการจ้าง
|
||||
*/
|
||||
@Get("employment/history/{id}")
|
||||
@Get("employment/history/{id}")//ตสTEMP
|
||||
async GetHistoryEmploymentById(@Path() id: string) {
|
||||
const employmentHistory = await this.employmentHistoryRepository.find({
|
||||
where: { profileEmployeeEmploymentId: id },
|
||||
|
|
@ -3032,7 +3035,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Post("employment/{profileEmployeeId}")
|
||||
@Post("employment/{profileEmployeeId}")//ตสTEMP
|
||||
async CreateEmployment(
|
||||
@Path() profileEmployeeId: string,
|
||||
@Body() body: CreateEmploymentProfileEmployee,
|
||||
|
|
@ -3071,7 +3074,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} id Id ข้อมูลการจ้าง
|
||||
*/
|
||||
@Delete("employment/{id}")
|
||||
@Delete("employment/{id}")//ตสTEMP
|
||||
async DeleteEmployment(@Path() id: string) {
|
||||
await this.employmentHistoryRepository.delete({
|
||||
profileEmployeeEmploymentId: id,
|
||||
|
|
@ -3091,7 +3094,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} id Id ข้อมูลการจ้าง
|
||||
*/
|
||||
@Put("employment/{id}")
|
||||
@Put("employment/{id}")//ตสTEMP
|
||||
async UpdateEmployment(
|
||||
@Request() request: RequestWithUser,
|
||||
@Path() id: string,
|
||||
|
|
@ -3124,7 +3127,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @summary ORG_038 - ออกคำสั่งลูกจ้าง (ADMIN) #
|
||||
*
|
||||
*/
|
||||
@Post("report")
|
||||
@Post("report")//ตสTEMP
|
||||
async sendReport(@Request() request: RequestWithUser, @Body() requestBody: { id: string[] }) {
|
||||
const profiles = await this.profileRepo.find({ where: { id: In(requestBody.id) } });
|
||||
|
||||
|
|
@ -3148,7 +3151,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @summary ORG_038 - ออกคำสั่งลูกจ้าง (ADMIN) #
|
||||
*
|
||||
*/
|
||||
@Post("report/resume")
|
||||
@Post("report/resume")//ตสTEMP
|
||||
async doneReport(
|
||||
@Body()
|
||||
body: {
|
||||
|
|
@ -3213,7 +3216,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @summary ค้นหาข้อมูลทะเบียนประวัติที่ยังไม่เชื่อม keycloak
|
||||
*
|
||||
*/
|
||||
@Post("search-personal-no-keycloak")
|
||||
@Post("search-personal-no-keycloak")//ตสTEMP
|
||||
async getProfileBySearchKeywordNoKeyCloak(
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
|
|
@ -3379,7 +3382,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @summary ORG_065 - ข้อมูลทะเบียนประวัติตาม profileid (ADMIN) #70
|
||||
*
|
||||
*/
|
||||
@Get("profileid/position/{id}")
|
||||
@Get("profileid/position/{id}")//ตสTEMP
|
||||
async getProfileByProfileid(
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Path() id: string,
|
||||
|
|
|
|||
|
|
@ -77,7 +77,8 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller {
|
|||
profileEmployeeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
|
||||
},
|
||||
})
|
||||
public async getFamilyCouple(@Path() profileEmployeeId: string) {
|
||||
public async getFamilyCouple(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -112,6 +113,7 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller {
|
|||
*/
|
||||
@Get("history/user")
|
||||
public async familyCoupleHistoryUser(@Request() request: RequestWithUser) {
|
||||
await new permission().PermissionGet(request, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepo.findOneBy({ keycloak: request.user.sub });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
|
|
@ -176,7 +178,8 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async familyCoupleHistory(@Path() profileEmployeeId: string) {
|
||||
public async familyCoupleHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -73,7 +73,8 @@ export class ProfileFamilyFatherEmployeeTempController extends Controller {
|
|||
profileEmployeeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
|
||||
},
|
||||
})
|
||||
public async getFamilyFather(@Path() profileEmployeeId: string) {
|
||||
public async getFamilyFather(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -164,7 +165,8 @@ export class ProfileFamilyFatherEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async familyFatherHistory(@Path() profileEmployeeId: string) {
|
||||
public async familyFatherHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -73,7 +73,8 @@ export class ProfileFamilyMotherEmployeeTempController extends Controller {
|
|||
profileEmployeeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
|
||||
},
|
||||
})
|
||||
public async getFamilyMother(@Path() profileEmployeeId: string) {
|
||||
public async getFamilyMother(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -164,7 +165,8 @@ export class ProfileFamilyMotherEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async familyMotherHistory(@Path() profileEmployeeId: string) {
|
||||
public async familyMotherHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -134,7 +134,8 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
|
|||
*/
|
||||
@Get("{profileEmployeeId}")
|
||||
@Example({})
|
||||
public async getGovHistory(@Path() profileEmployeeId: string) {
|
||||
public async getGovHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.profileEmployeeRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
relations: {
|
||||
|
|
@ -240,7 +241,8 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
|
|||
*/
|
||||
@Get("history/{profileEmployeeId}")
|
||||
@Example({})
|
||||
public async govHistory(@Path() profileEmployeeId: string) {
|
||||
public async govHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.govRepo.find({
|
||||
order: { lastUpdatedAt: "DESC" },
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@ export class ProfileHonorEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async getHonor(@Path() profileEmployeeId: string) {
|
||||
public async getHonor(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.honorRepo.findBy({ profileEmployeeId });
|
||||
return new HttpSuccess(record);
|
||||
}
|
||||
|
|
@ -80,6 +81,7 @@ export class ProfileHonorEmployeeTempController extends Controller {
|
|||
*/
|
||||
@Get("history/user")
|
||||
public async honorHistoryUser(@Request() request: RequestWithUser) {
|
||||
await new permission().PermissionGet(request, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileEmployeeRepo.findOneBy({ keycloak: request.user.sub });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
|
|
@ -133,7 +135,8 @@ export class ProfileHonorEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async honorHistory(@Path() honorId: string) {
|
||||
public async honorHistory(@Path() honorId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.honorHistoryRepo.findBy({
|
||||
profileHonorId: honorId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -83,7 +83,8 @@ export class ProfileInsigniaEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async getInsignia(@Path() profileEmployeeId: string) {
|
||||
public async getInsignia(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.insigniaRepo.find({
|
||||
relations: {
|
||||
insignia: {
|
||||
|
|
@ -150,7 +151,8 @@ export class ProfileInsigniaEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async getInsigniaHistory(@Path() InsigniaId: string) {
|
||||
public async getInsigniaHistory(@Path() InsigniaId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.insigniaHistoryRepo.find({
|
||||
relations: {
|
||||
insignia: {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ export class ProfileLeaveEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("{profileId}")
|
||||
public async getLeave(@Path() profileId: string) {
|
||||
public async getLeave(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.leaveRepo.find({
|
||||
relations: { leaveType: true },
|
||||
where: { profileEmployeeId: profileId },
|
||||
|
|
@ -58,7 +59,8 @@ export class ProfileLeaveEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("history/{leaveId}")
|
||||
public async leaveHistory(@Path() leaveId: string) {
|
||||
public async leaveHistory(@Path() leaveId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.leaveHistoryRepo.find({
|
||||
relations: { leaveType: true },
|
||||
where: { profileLeaveId: leaveId },
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ export class ProfileNopaidEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("{profileId}")
|
||||
public async getNopaid(@Path() profileId: string) {
|
||||
public async getNopaid(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const lists = await this.nopaidRepository.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
});
|
||||
|
|
@ -54,7 +55,8 @@ export class ProfileNopaidEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("history/{nopaidId}")
|
||||
public async nopaidHistory(@Path() nopaidId: string) {
|
||||
public async nopaidHistory(@Path() nopaidId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.nopaidHistoryRepository.find({
|
||||
where: { profileNopaidId: nopaidId },
|
||||
order: { createdAt: "DESC" },
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ export class ProfileOtherEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("{profileId}")
|
||||
public async getOther(@Path() profileId: string) {
|
||||
public async getOther(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const lists = await this.otherRepository.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
});
|
||||
|
|
@ -54,7 +55,8 @@ export class ProfileOtherEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("history/{otherId}")
|
||||
public async otherHistory(@Path() otherId: string) {
|
||||
public async otherHistory(@Path() otherId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.otherHistoryRepository.find({
|
||||
where: { profileOtherId: otherId },
|
||||
order: { createdAt: "DESC" },
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ export class ProfileSalaryEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("{profileId}")
|
||||
public async getSalaryEmployee(@Path() profileId: string) {
|
||||
public async getSalaryEmployee(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.salaryRepo.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { order: "ASC" },
|
||||
|
|
@ -57,7 +58,8 @@ export class ProfileSalaryEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("history/{salaryId}")
|
||||
public async salaryHistory(@Path() salaryId: string) {
|
||||
public async salaryHistory(@Path() salaryId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.salaryHistoryRepo.findBy({
|
||||
profileSalaryId: salaryId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -74,7 +74,8 @@ export class ProfileTrainingEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async getTraining(@Path() profileEmployeeId: string) {
|
||||
public async getTraining(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.trainingRepo.findBy({ profileEmployeeId });
|
||||
return new HttpSuccess(record);
|
||||
}
|
||||
|
|
@ -130,7 +131,8 @@ export class ProfileTrainingEmployeeTempController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
public async trainingHistory(@Path() trainingId: string) {
|
||||
public async trainingHistory(@Path() trainingId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.trainingHistoryRepo.findBy({
|
||||
profileTrainingId: trainingId,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue