Files
api-AT/src/mensaje/mensaje.controller.ts
T

25 lines
784 B
TypeScript
Raw Normal View History

2026-02-23 18:16:17 -06:00
import { Controller, Get, Param, UseGuards } from '@nestjs/common';
import { MensajeService } from './mensaje.service';
2026-02-23 18:16:17 -06:00
import { JwtAuthGuard } from 'src/user/jwt.guard';
2026-03-02 14:49:15 -06:00
import { RolesGuard } from 'src/roles.guard';
import { Roles } from 'src/roles.decorator';
import { Role } from 'src/role.enum';
@Controller('mensaje')
export class MensajeController {
2026-02-23 18:16:17 -06:00
constructor(private readonly mensajeService: MensajeService) { }
2026-03-02 14:49:15 -06:00
@UseGuards(JwtAuthGuard, RolesGuard)
@Get() @Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
findAll() {
return this.mensajeService.findAll();
}
2026-03-02 14:49:15 -06:00
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Get(':id')
findOne(@Param('id') id: string) {
return this.mensajeService.findOne(+id);
}
}