เพิ่้มและลบ api history/user
This commit is contained in:
parent
abc4aee8a4
commit
8d1de6365a
22 changed files with 512 additions and 466 deletions
|
|
@ -89,35 +89,6 @@ export class ProfileAssessmentsEmployeeController extends Controller {
|
|||
return new HttpSuccess(getProfileAssessments);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary ประวัติแก้ไขการประเมิน by keycloak
|
||||
*
|
||||
*/
|
||||
@Get("history/user")
|
||||
public async getProfileAssessmentsHistoryUser(@Request() request: RequestWithUser) {
|
||||
const profile = await this.profileEmployeeRepo.findOneBy({ keycloak: request.user.sub });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
const record = await this.profileAssessmentsHistoryRepository.find({
|
||||
relations: {
|
||||
histories: true,
|
||||
},
|
||||
where: {
|
||||
histories: {
|
||||
profileEmployeeId: profile.id,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (!record) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
return new HttpSuccess(record);
|
||||
}
|
||||
|
||||
@Get("history/{assessmentId}")
|
||||
@Example({
|
||||
status: 200,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue