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
+19 -8
View File
@@ -10,48 +10,58 @@ import {
import { BitacoraMesaService } from './bitacora_mesa.service';
import { CreateBitacoraMesaDto, FindByDate } from './dto/create-bitacora_mesa.dto';
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('bitacora-mesa')
export class BitacoraMesaController {
constructor(private readonly bitacoraMesaService: BitacoraMesaService) { }
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
@Post()
assignment(@Body() createBitacoraMesaDto: CreateBitacoraMesaDto) {
return this.bitacoraMesaService.assignment(createBitacoraMesaDto);
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Get()
findAll() {
return this.bitacoraMesaService.findAll();
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Get(':id')
findOne(@Param('id') id: string) {
return this.bitacoraMesaService.findOne(+id);
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
@Get('/cuenta/:id_cuenta')
findByCuenta(@Param('id_cuenta') id_cuenta: string) {
return this.bitacoraMesaService.findByCuenta(+id_cuenta);
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
@Get('/table/:id_mesa')
findByTable(@Param('id_mesa') id_mesa: number) {
return this.bitacoraMesaService.findByTable(id_mesa);
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Post('/date')
findByDate(@Body() data: FindByDate) {
return this.bitacoraMesaService.findByDate(data.date);
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
@Patch('cancelar/:id')
cancelationByMachine(
@Param('id') id: number,
@@ -60,7 +70,8 @@ export class BitacoraMesaController {
return this.bitacoraMesaService.cancelation(id, tiempo_asignado);
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Post('mesas-por-dia')
mesasPorDia(@Body() body: { fecha: string }) {
return this.bitacoraMesaService.mesasPorFecha(body.fecha);