add parth admin history

This commit is contained in:
AdisakKanthawilang 2024-09-09 18:10:01 +07:00
parent 74e64176e6
commit 4b6fd79264
23 changed files with 309 additions and 50 deletions

View file

@ -66,12 +66,10 @@ export class ProfileAbilityController extends Controller {
@Path() abilityId: string, @Path() abilityId: string,
@Request() req: RequestWithUser, @Request() req: RequestWithUser,
) { ) {
const _record = await this.profileAbilityRepo.findOne({ const _record = await this.profileAbilityRepo.findOneBy({ id: abilityId });
where: { id: abilityId }, if (_record) {
}); await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
if (_record) { }
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
}
const record = await this.profileAbilityHistoryRepo.find({ const record = await this.profileAbilityHistoryRepo.find({
where: { profileAbilityId: abilityId }, where: { profileAbilityId: abilityId },

View file

@ -67,8 +67,8 @@ export class ProfileAssessmentsEmployeeController extends Controller {
return new HttpSuccess(getProfileAssessments); return new HttpSuccess(getProfileAssessments);
} }
@Get("history/{assessmentId}") @Get("admin/history/{assessmentId}")
public async getProfileAssessmentsHistory( public async getProfileAdminAssessmentsHistory(
@Path() assessmentId: string, @Path() assessmentId: string,
@Request() req: RequestWithUser, @Request() req: RequestWithUser,
) { ) {
@ -89,6 +89,23 @@ export class ProfileAssessmentsEmployeeController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{assessmentId}")
public async getProfileAssessmentsHistory(
@Path() assessmentId: string,
) {
const record = await this.profileAssessmentsHistoryRepository.find({
where: {
profileAssessmentId: assessmentId,
},
order: { createdAt: "DESC" },
});
if (!record) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
}
return new HttpSuccess(record);
}
@Post() @Post()
public async profileAssessment( public async profileAssessment(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,

View file

@ -67,8 +67,8 @@ export class ProfileAssessmentsEmployeeTempController extends Controller {
return new HttpSuccess(getProfileAssessments); return new HttpSuccess(getProfileAssessments);
} }
@Get("history/{assessmentId}") @Get("admin/history/{assessmentId}")
public async getProfileAssessmentsHistory( public async getProfileAdminAssessmentsHistory(
@Path() assessmentId: string, @Path() assessmentId: string,
@Request() req: RequestWithUser, @Request() req: RequestWithUser,
) { ) {
@ -87,6 +87,24 @@ export class ProfileAssessmentsEmployeeTempController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{assessmentId}")
public async getProfileAssessmentsHistory(
@Path() assessmentId: string,
) {
const record = await this.profileAssessmentsHistoryRepository.find({
where: {
profileAssessmentId: assessmentId,
},
order: { createdAt: "DESC" },
});
if (!record) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
}
return new HttpSuccess(record);
}
@Post() @Post()
public async profileAssessment( public async profileAssessment(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,

View file

@ -55,8 +55,8 @@ export class ProfileCertificateEmployeeController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{certificateId}") @Get("admin/history/{certificateId}")
public async certificateHistory(@Path() certificateId: string, @Request() req: RequestWithUser) { public async certificateAdminHistory(@Path() certificateId: string, @Request() req: RequestWithUser) {
const _record = await this.certificateRepo.findOneBy({ id: certificateId }); const _record = await this.certificateRepo.findOneBy({ id: certificateId });
if (_record) { if (_record) {
await new permission().PermissionOrgUserGet( await new permission().PermissionOrgUserGet(
@ -73,6 +73,17 @@ export class ProfileCertificateEmployeeController extends Controller {
}); });
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{certificateId}")
public async certificateHistory(@Path() certificateId: string) {
const record = await this.certificateHistoryRepo.find({
where: {
profileCertificateId: certificateId,
},
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newCertificate( public async newCertificate(

View file

@ -55,8 +55,8 @@ export class ProfileCertificateEmployeeTempController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{certificateId}") @Get("admin/history/{certificateId}")
public async certificateHistory(@Path() certificateId: string, @Request() req: RequestWithUser) { public async certificateAdminHistory(@Path() certificateId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.certificateHistoryRepo.find({ const record = await this.certificateHistoryRepo.find({
where: { where: {
@ -67,6 +67,17 @@ export class ProfileCertificateEmployeeTempController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{certificateId}")
public async certificateHistory(@Path() certificateId: string) {
const record = await this.certificateHistoryRepo.find({
where: {
profileCertificateId: certificateId,
},
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newCertificate( public async newCertificate(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,

View file

@ -65,8 +65,8 @@ export class ProfileDisciplineEmployeeController extends Controller {
return new HttpSuccess(lists); return new HttpSuccess(lists);
} }
@Get("history/{disciplineId}") @Get("admin/history/{disciplineId}")
public async disciplineHistory(@Path() disciplineId: string, @Request() req: RequestWithUser) { public async disciplineAdminHistory(@Path() disciplineId: string, @Request() req: RequestWithUser) {
const _record = await this.disciplineRepository.findOneBy({ id: disciplineId }); const _record = await this.disciplineRepository.findOneBy({ id: disciplineId });
if (_record) { if (_record) {
await new permission().PermissionOrgUserGet( await new permission().PermissionOrgUserGet(
@ -82,6 +82,15 @@ export class ProfileDisciplineEmployeeController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{disciplineId}")
public async disciplineHistory(@Path() disciplineId: string) {
const record = await this.disciplineHistoryRepository.find({
where: { profileDisciplineId: disciplineId },
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newDiscipline( public async newDiscipline(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,

View file

@ -65,8 +65,8 @@ export class ProfileDisciplineEmployeeTempController extends Controller {
return new HttpSuccess(lists); return new HttpSuccess(lists);
} }
@Get("history/{disciplineId}") @Get("admin/history/{disciplineId}")
public async disciplineHistory(@Path() disciplineId: string, @Request() req: RequestWithUser) { public async disciplineAdminHistory(@Path() disciplineId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.disciplineHistoryRepository.find({ const record = await this.disciplineHistoryRepository.find({
where: { profileDisciplineId: disciplineId }, where: { profileDisciplineId: disciplineId },
@ -75,6 +75,15 @@ export class ProfileDisciplineEmployeeTempController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{disciplineId}")
public async disciplineHistory(@Path() disciplineId: string) {
const record = await this.disciplineHistoryRepository.find({
where: { profileDisciplineId: disciplineId },
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newDiscipline( public async newDiscipline(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,

View file

@ -51,8 +51,8 @@ export class ProfileDutyEmployeeController extends Controller {
return new HttpSuccess(lists); return new HttpSuccess(lists);
} }
@Get("history/{dutyId}") @Get("admin/history/{dutyId}")
public async dutyHistory(@Path() dutyId: string, @Request() req: RequestWithUser) { public async dutyAdminHistory(@Path() dutyId: string, @Request() req: RequestWithUser) {
const _record = await this.dutyRepository.findOneBy({ id: dutyId }); const _record = await this.dutyRepository.findOneBy({ id: dutyId });
if (_record) { if (_record) {
await new permission().PermissionOrgUserGet( await new permission().PermissionOrgUserGet(
@ -68,6 +68,15 @@ export class ProfileDutyEmployeeController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{dutyId}")
public async dutyHistory(@Path() dutyId: string) {
const record = await this.dutyHistoryRepository.find({
where: { profileDutyId: dutyId },
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newDuty(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeDuty) { public async newDuty(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeDuty) {
if (!body.profileEmployeeId) { if (!body.profileEmployeeId) {

View file

@ -51,8 +51,8 @@ export class ProfileDutyEmployeeTempController extends Controller {
return new HttpSuccess(lists); return new HttpSuccess(lists);
} }
@Get("history/{dutyId}") @Get("admin/history/{dutyId}")
public async dutyHistory(@Path() dutyId: string, @Request() req: RequestWithUser) { public async dutyAdminHistory(@Path() dutyId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.dutyHistoryRepository.find({ const record = await this.dutyHistoryRepository.find({
where: { profileDutyId: dutyId }, where: { profileDutyId: dutyId },
@ -61,6 +61,15 @@ export class ProfileDutyEmployeeTempController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{dutyId}")
public async dutyHistory(@Path() dutyId: string) {
const record = await this.dutyHistoryRepository.find({
where: { profileDutyId: dutyId },
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newDuty(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeDuty) { public async newDuty(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeDuty) {
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");

View file

@ -64,8 +64,8 @@ export class ProfileEducationsEmployeeController extends Controller {
return new HttpSuccess(getProfileEducation); return new HttpSuccess(getProfileEducation);
} }
@Get("history/{educationId}") @Get("admin/history/{educationId}")
public async getProfileEducationHistory( public async getProfileAdminEducationHistory(
@Path() educationId: string, @Path() educationId: string,
@Request() req: RequestWithUser, @Request() req: RequestWithUser,
) { ) {
@ -90,6 +90,22 @@ export class ProfileEducationsEmployeeController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{educationId}")
public async getProfileEducationHistory(
@Path() educationId: string,
) {
const record = await this.profileEducationHistoryRepo.find({
where: {
profileEducationId: educationId,
},
order: { createdAt: "DESC" },
});
if (!record) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
}
return new HttpSuccess(record);
}
@Post() @Post()
public async newProfileEducation( public async newProfileEducation(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,

View file

@ -64,8 +64,8 @@ export class ProfileEducationsEmployeeTempController extends Controller {
return new HttpSuccess(getProfileEducation); return new HttpSuccess(getProfileEducation);
} }
@Get("history/{educationId}") @Get("admin/history/{educationId}")
public async getProfileEducationHistory( public async getProfileAdminEducationHistory(
@Path() educationId: string, @Path() educationId: string,
@Request() req: RequestWithUser, @Request() req: RequestWithUser,
) { ) {
@ -82,6 +82,22 @@ export class ProfileEducationsEmployeeTempController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{educationId}")
public async getProfileEducationHistory(
@Path() educationId: string,
) {
const record = await this.profileEducationHistoryRepo.find({
where: {
profileEducationId: educationId,
},
order: { createdAt: "DESC" },
});
if (!record) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
}
return new HttpSuccess(record);
}
@Post() @Post()
public async newProfileEducation( public async newProfileEducation(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,

View file

@ -77,8 +77,8 @@ export class ProfileHonorEmployeeController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{honorId}") @Get("admin/history/{honorId}")
public async honorHistory(@Path() honorId: string, @Request() req: RequestWithUser) { public async honorAdminHistory(@Path() honorId: string, @Request() req: RequestWithUser) {
const _record = await this.honorRepo.findOneBy({ id: honorId }); const _record = await this.honorRepo.findOneBy({ id: honorId });
if (_record) { if (_record) {
await new permission().PermissionOrgUserGet( await new permission().PermissionOrgUserGet(
@ -97,6 +97,17 @@ export class ProfileHonorEmployeeController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{honorId}")
public async honorHistory(@Path() honorId: string) {
const record = await this.honorHistoryRepo.find({
where: {
profileHonorId: honorId,
},
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newHonor(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeHonor) { public async newHonor(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeHonor) {
if (!body.profileEmployeeId) { if (!body.profileEmployeeId) {

View file

@ -77,8 +77,8 @@ export class ProfileHonorEmployeeTempController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{honorId}") @Get("admin/history/{honorId}")
public async honorHistory(@Path() honorId: string, @Request() req: RequestWithUser) { public async honorAdminHistory(@Path() honorId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.honorHistoryRepo.find({ const record = await this.honorHistoryRepo.find({
where: { where: {
@ -89,6 +89,17 @@ export class ProfileHonorEmployeeTempController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{honorId}")
public async honorHistory(@Path() honorId: string) {
const record = await this.honorHistoryRepo.find({
where: {
profileHonorId: honorId,
},
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newHonor(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeHonor) { public async newHonor(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeHonor) {
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");

View file

@ -67,8 +67,8 @@ export class ProfileInsigniaEmployeeController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{InsigniaId}") @Get("admin/history/{InsigniaId}")
public async getInsigniaHistory(@Path() InsigniaId: string, @Request() req: RequestWithUser) { public async getInsigniaAdminHistory(@Path() InsigniaId: string, @Request() req: RequestWithUser) {
const _record = await this.insigniaRepo.findOneBy({ id: InsigniaId }); const _record = await this.insigniaRepo.findOneBy({ id: InsigniaId });
if (_record) { if (_record) {
await new permission().PermissionOrgUserGet( await new permission().PermissionOrgUserGet(
@ -91,6 +91,22 @@ export class ProfileInsigniaEmployeeController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{InsigniaId}")
public async getInsigniaHistory(@Path() InsigniaId: string) {
const record = await this.insigniaHistoryRepo.find({
relations: {
insignia: {
insigniaType: true,
},
},
where: {
profileInsigniaId: InsigniaId,
},
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newInsignia( public async newInsignia(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,

View file

@ -67,8 +67,8 @@ export class ProfileInsigniaEmployeeTempController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{InsigniaId}") @Get("admin/history/{InsigniaId}")
public async getInsigniaHistory(@Path() InsigniaId: string, @Request() req: RequestWithUser) { public async getInsigniaAdminHistory(@Path() InsigniaId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.insigniaHistoryRepo.find({ const record = await this.insigniaHistoryRepo.find({
relations: { relations: {
@ -84,6 +84,22 @@ export class ProfileInsigniaEmployeeTempController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{InsigniaId}")
public async getInsigniaHistory(@Path() InsigniaId: string) {
const record = await this.insigniaHistoryRepo.find({
relations: {
insignia: {
insigniaType: true,
},
},
where: {
profileInsigniaId: InsigniaId,
},
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newInsignia( public async newInsignia(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,

View file

@ -70,8 +70,8 @@ export class ProfileLeaveEmployeeController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{leaveId}") @Get("admin/history/{leaveId}")
public async leaveHistory(@Path() leaveId: string, @Request() req: RequestWithUser) { public async leaveAdminHistory(@Path() leaveId: string, @Request() req: RequestWithUser) {
const _record = await this.leaveRepo.findOneBy({ id: leaveId }); const _record = await this.leaveRepo.findOneBy({ id: leaveId });
if (_record) { if (_record) {
await new permission().PermissionOrgUserGet( await new permission().PermissionOrgUserGet(
@ -88,6 +88,16 @@ export class ProfileLeaveEmployeeController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{leaveId}")
public async leaveHistory(@Path() leaveId: string) {
const record = await this.leaveHistoryRepo.find({
relations: { leaveType: true },
where: { profileLeaveId: leaveId },
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newLeave(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeLeave) { public async newLeave(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeLeave) {
if (!body.profileEmployeeId) { if (!body.profileEmployeeId) {

View file

@ -70,8 +70,8 @@ export class ProfileLeaveEmployeeTempController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{leaveId}") @Get("admin/history/{leaveId}")
public async leaveHistory(@Path() leaveId: string, @Request() req: RequestWithUser) { public async leaveAdminHistory(@Path() leaveId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.leaveHistoryRepo.find({ const record = await this.leaveHistoryRepo.find({
relations: { leaveType: true }, relations: { leaveType: true },
@ -81,6 +81,16 @@ export class ProfileLeaveEmployeeTempController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{leaveId}")
public async leaveHistory(@Path() leaveId: string) {
const record = await this.leaveHistoryRepo.find({
relations: { leaveType: true },
where: { profileLeaveId: leaveId },
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newLeave(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeLeave) { public async newLeave(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeLeave) {
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");

View file

@ -55,8 +55,8 @@ export class ProfileOtherEmployeeController extends Controller {
return new HttpSuccess(lists); return new HttpSuccess(lists);
} }
@Get("history/{otherId}") @Get("admin/history/{otherId}")
public async otherHistory(@Path() otherId: string, @Request() req: RequestWithUser) { public async otherAdminHistory(@Path() otherId: string, @Request() req: RequestWithUser) {
const _record = await this.otherRepository.findOneBy({ id: otherId }); const _record = await this.otherRepository.findOneBy({ id: otherId });
if (_record) { if (_record) {
await new permission().PermissionOrgUserGet( await new permission().PermissionOrgUserGet(
@ -71,6 +71,15 @@ export class ProfileOtherEmployeeController extends Controller {
}); });
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{otherId}")
public async otherHistory(@Path() otherId: string) {
const record = await this.otherHistoryRepository.find({
where: { profileOtherId: otherId },
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newOther(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeOther) { public async newOther(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeOther) {

View file

@ -56,8 +56,8 @@ export class ProfileOtherEmployeeTempController extends Controller {
return new HttpSuccess(lists); return new HttpSuccess(lists);
} }
@Get("history/{otherId}") @Get("admin/history/{otherId}")
public async otherHistory(@Path() otherId: string, @Request() req: RequestWithUser) { public async otherAdminHistory(@Path() otherId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.otherHistoryRepository.find({ const record = await this.otherHistoryRepository.find({
where: { profileOtherId: otherId }, where: { profileOtherId: otherId },
@ -66,6 +66,15 @@ export class ProfileOtherEmployeeTempController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{otherId}")
public async otherHistory(@Path() otherId: string) {
const record = await this.otherHistoryRepository.find({
where: { profileOtherId: otherId },
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newOther(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeOther) { public async newOther(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeOther) {
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP"); await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");

View file

@ -66,8 +66,8 @@ export class ProfileSalaryEmployeeController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{salaryId}") @Get("admin/history/{salaryId}")
public async salaryHistory(@Path() salaryId: string, @Request() req: RequestWithUser) { public async salaryAdminHistory(@Path() salaryId: string, @Request() req: RequestWithUser) {
const _record = await this.salaryRepo.findOneBy({ id: salaryId }); const _record = await this.salaryRepo.findOneBy({ id: salaryId });
if (_record) { if (_record) {
await new permission().PermissionOrgUserGet( await new permission().PermissionOrgUserGet(
@ -85,6 +85,17 @@ export class ProfileSalaryEmployeeController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{salaryId}")
public async salaryHistory(@Path() salaryId: string) {
const record = await this.salaryHistoryRepo.find({
where: {
profileSalaryId: salaryId,
},
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newSalaryEmployee( public async newSalaryEmployee(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,

View file

@ -66,8 +66,8 @@ export class ProfileSalaryEmployeeTempController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{salaryId}") @Get("admin/history/{salaryId}")
public async salaryHistory(@Path() salaryId: string, @Request() req: RequestWithUser) { public async salaryAdminHistory(@Path() salaryId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.salaryHistoryRepo.find({ const record = await this.salaryHistoryRepo.find({
where: { where: {
@ -78,6 +78,17 @@ export class ProfileSalaryEmployeeTempController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{salaryId}")
public async salaryHistory(@Path() salaryId: string) {
const record = await this.salaryHistoryRepo.find({
where: {
profileSalaryId: salaryId,
},
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newSalaryEmployee( public async newSalaryEmployee(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,

View file

@ -56,8 +56,8 @@ export class ProfileTrainingEmployeeController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{trainingId}") @Get("admin/history/{trainingId}")
public async trainingHistory(@Path() trainingId: string, @Request() req: RequestWithUser) { public async trainingAdminHistory(@Path() trainingId: string, @Request() req: RequestWithUser) {
const _record = await this.trainingRepo.findOneBy({ id: trainingId }); const _record = await this.trainingRepo.findOneBy({ id: trainingId });
if (_record) { if (_record) {
await new permission().PermissionOrgUserGet( await new permission().PermissionOrgUserGet(
@ -76,6 +76,17 @@ export class ProfileTrainingEmployeeController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{trainingId}")
public async trainingHistory(@Path() trainingId: string) {
const record = await this.trainingHistoryRepo.find({
where: {
profileTrainingId: trainingId,
},
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newTraining( public async newTraining(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,

View file

@ -56,8 +56,8 @@ export class ProfileTrainingEmployeeTempController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{trainingId}") @Get("admin/history/{trainingId}")
public async trainingHistory(@Path() trainingId: string, @Request() req: RequestWithUser) { public async trainingAdminHistory(@Path() trainingId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.trainingHistoryRepo.find({ const record = await this.trainingHistoryRepo.find({
where: { where: {
@ -68,6 +68,17 @@ export class ProfileTrainingEmployeeTempController extends Controller {
return new HttpSuccess(record); return new HttpSuccess(record);
} }
@Get("history/{trainingId}")
public async trainingHistory(@Path() trainingId: string) {
const record = await this.trainingHistoryRepo.find({
where: {
profileTrainingId: trainingId,
},
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post() @Post()
public async newTraining( public async newTraining(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,