added all roles
This commit is contained in:
@@ -1,18 +1,22 @@
|
||||
import { Controller, Get, Param, UseGuards } from '@nestjs/common';
|
||||
import { MensajeService } from './mensaje.service';
|
||||
import { JwtAuthGuard } from 'src/user/jwt.guard';
|
||||
import { RolesGuard } from 'src/roles.guard';
|
||||
import { Roles } from 'src/roles.decorator';
|
||||
import { Role } from 'src/role.enum';
|
||||
|
||||
@Controller('mensaje')
|
||||
export class MensajeController {
|
||||
constructor(private readonly mensajeService: MensajeService) { }
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get()
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Get() @Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
|
||||
findAll() {
|
||||
return this.mensajeService.findAll();
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
|
||||
@Get(':id')
|
||||
findOne(@Param('id') id: string) {
|
||||
return this.mensajeService.findOne(+id);
|
||||
|
||||
Reference in New Issue
Block a user