add api history/user done
This commit is contained in:
parent
10377150dd
commit
a66f582c25
2 changed files with 42 additions and 0 deletions
|
|
@ -69,6 +69,27 @@ export class ProfileHonorController extends Controller {
|
|||
return new HttpSuccess(record);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary ประวัติแก้ไขเกียรติประวัติ by keycloak
|
||||
*
|
||||
*/
|
||||
@Get("history/user")
|
||||
public async honorHistoryUser(@Request() request: RequestWithUser) {
|
||||
const profile = await this.profileRepo.findOneBy({ keycloak: request.user.sub });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
const record = await this.honorHistoryRepo.find({
|
||||
where: {
|
||||
histories: {
|
||||
profileId: profile.id,
|
||||
},
|
||||
},
|
||||
});
|
||||
return new HttpSuccess(record);
|
||||
}
|
||||
|
||||
@Get("history/{honorId}")
|
||||
@Example({
|
||||
status: 200,
|
||||
|
|
|
|||
|
|
@ -69,6 +69,27 @@ export class ProfileHonorEmployeeController extends Controller {
|
|||
return new HttpSuccess(record);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary ประวัติแก้ไขเกียรติประวัติ by keycloak
|
||||
*
|
||||
*/
|
||||
@Get("history/user")
|
||||
public async honorHistoryUser(@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.honorHistoryRepo.find({
|
||||
where: {
|
||||
histories: {
|
||||
profileEmployeeId: profile.id,
|
||||
},
|
||||
},
|
||||
});
|
||||
return new HttpSuccess(record);
|
||||
}
|
||||
|
||||
@Get("history/{honorId}")
|
||||
@Example({
|
||||
status: 200,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue