fix and add profile by key cloak
This commit is contained in:
parent
7b480b1247
commit
eb85bdcb45
5 changed files with 143 additions and 19 deletions
|
|
@ -79,6 +79,25 @@ export class ProfileAbilityController extends Controller {
|
|||
return new HttpSuccess(getProfileAbilityId);
|
||||
}
|
||||
|
||||
@Get("history/user")
|
||||
public async getProfileAbilityHistoryUser(@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.profileAbilityHistoryRepo.find({
|
||||
where: {
|
||||
histories: {
|
||||
profileId: profile.id,
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!record) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
return new HttpSuccess(record);
|
||||
}
|
||||
|
||||
@Get("history/{abilityId}")
|
||||
@Example({
|
||||
status: 200,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue