feat: Add user role retrieval, enhance recommended course filtering and detail, and introduce new k6 load tests.
This commit is contained in:
parent
e3873f616e
commit
45b9c6516b
11 changed files with 515 additions and 139 deletions
|
|
@ -10,7 +10,8 @@ import {
|
|||
ChangePasswordResponse,
|
||||
updateAvatarResponse,
|
||||
SendVerifyEmailResponse,
|
||||
VerifyEmailResponse
|
||||
VerifyEmailResponse,
|
||||
rolesResponse
|
||||
} from '../types/user.types';
|
||||
import { ChangePassword } from '../types/auth.types';
|
||||
import { profileUpdateSchema, changePasswordSchema } from "../validators/user.validator";
|
||||
|
|
@ -56,6 +57,18 @@ export class UserController {
|
|||
return await this.userService.updateProfile(token, body);
|
||||
}
|
||||
|
||||
@Get('roles')
|
||||
@Security('jwt')
|
||||
@SuccessResponse('200', 'Roles retrieved successfully')
|
||||
@Response('401', 'Invalid or expired token')
|
||||
public async getRoles(@Request() request: any): Promise<rolesResponse> {
|
||||
const token = request.headers.authorization?.replace('Bearer ', '');
|
||||
if (!token) {
|
||||
throw new ValidationError('No token provided');
|
||||
}
|
||||
return await this.userService.getRoles(token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change password
|
||||
* @summary Change user password using old password
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue