added all roles

This commit is contained in:
2026-03-02 14:49:15 -06:00
parent 8aa0eab353
commit 0323c93ca3
22 changed files with 233 additions and 92 deletions
+7 -3
View File
@@ -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);