25 lines
784 B
TypeScript
25 lines
784 B
TypeScript
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, RolesGuard)
|
|
@Get() @Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
|
|
findAll() {
|
|
return this.mensajeService.findAll();
|
|
}
|
|
|
|
@UseGuards(JwtAuthGuard, RolesGuard)
|
|
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
|
|
@Get(':id')
|
|
findOne(@Param('id') id: string) {
|
|
return this.mensajeService.findOne(+id);
|
|
}
|
|
}
|