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