API checkRole and history/user

This commit is contained in:
AdisakKanthawilang 2024-05-27 11:36:55 +07:00
parent 38871bcc80
commit 3167fe271e
7 changed files with 142 additions and 6 deletions

View file

@ -79,12 +79,17 @@ export class ProfileAbilityController extends Controller {
return new HttpSuccess(getProfileAbilityId);
}
/**
*
* @summary by keycloak
*
*/
@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 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: {