added all roles
This commit is contained in:
@@ -2,30 +2,37 @@ import { Controller, Body, Patch, Param, Get, UseGuards } from '@nestjs/common';
|
||||
import { MesaService } from './mesa.service';
|
||||
import { UpdateMesaDto } from './dto/update-mesa.dto';
|
||||
import { JwtAuthGuard } from 'src/user/jwt.guard';
|
||||
import { RolesGuard } from 'src/roles.guard';
|
||||
import { Role } from 'src/role.enum';
|
||||
import { Roles } from 'src/roles.decorator';
|
||||
|
||||
@Controller('mesa')
|
||||
export class MesaController {
|
||||
constructor(private readonly mesaService: MesaService) { }
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
|
||||
@Get()
|
||||
async findAll() {
|
||||
return this.mesaService.findAll();
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
|
||||
@Get('activo')
|
||||
async findAllActivo() {
|
||||
return this.mesaService.findAllActivo();
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
|
||||
@Get('uso')
|
||||
async findActiveMesas() {
|
||||
return this.mesaService.findActiveMesas();
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
|
||||
@Patch(':id')
|
||||
async updateActivo(
|
||||
@Param('id') id: number,
|
||||
@@ -34,7 +41,8 @@ export class MesaController {
|
||||
return this.mesaService.updateActivo(id, updateMesaDto);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
|
||||
@Patch(':id/activo')
|
||||
toggleActivo(@Param('id') id: number) {
|
||||
return this.mesaService.toggleActivo(+id);
|
||||
|
||||
Reference in New Issue
Block a user