feat: added role decorator to the authguard
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
import { applyDecorators, UseGuards } from "@nestjs/common";
|
import { applyDecorators, UseGuards } from '@nestjs/common';
|
||||||
import { ApiBearerAuth } from "@nestjs/swagger";
|
import { ApiBearerAuth } from '@nestjs/swagger';
|
||||||
import { JwtAuthGuard } from "src/modules/auth/guards/jwt-auth.guard";
|
import { JwtAuthGuard } from 'src/modules/auth/guards/jwt-auth.guard';
|
||||||
|
import { RoleGuard } from 'src/modules/auth/guards/role-guard';
|
||||||
|
|
||||||
export function AuthGuard() {
|
export function AuthGuard() {
|
||||||
return applyDecorators(
|
return applyDecorators(
|
||||||
UseGuards(JwtAuthGuard),
|
UseGuards(JwtAuthGuard, RoleGuard),
|
||||||
ApiBearerAuth('authorization')
|
ApiBearerAuth('authorization'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { UserMessages, UserRoleMessages } from 'src/common/enums/messages.enum';
|
|||||||
import { UserRole } from './entities/user-role.entity';
|
import { UserRole } from './entities/user-role.entity';
|
||||||
import { CreateUserRoleDto } from './DTO/create-user-role.dto';
|
import { CreateUserRoleDto } from './DTO/create-user-role.dto';
|
||||||
import { UserRoleRepository } from './repositories/user-role.repository';
|
import { UserRoleRepository } from './repositories/user-role.repository';
|
||||||
|
import { Complaint } from '../complaint/entities/complaint.entity';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UsersService {
|
export class UsersService {
|
||||||
|
|||||||
Reference in New Issue
Block a user