Files
api-AT/src/bitacora_mesa/bitacora_mesa.controller.ts
T
2026-03-02 14:49:15 -06:00

81 lines
2.5 KiB
TypeScript

import {
Controller,
Get,
Post,
Body,
Patch,
Param,
UseGuards,
} from '@nestjs/common';
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, 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, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Get()
findAll() {
return this.bitacoraMesaService.findAll();
}
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Get(':id')
findOne(@Param('id') id: string) {
return this.bitacoraMesaService.findOne(+id);
}
@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, 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, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Post('/date')
findByDate(@Body() data: FindByDate) {
return this.bitacoraMesaService.findByDate(data.date);
}
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
@Patch('cancelar/:id')
cancelationByMachine(
@Param('id') id: number,
@Body('tiempo_asignado') tiempo_asignado: number,
) {
return this.bitacoraMesaService.cancelation(id, tiempo_asignado);
}
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Post('mesas-por-dia')
mesasPorDia(@Body() body: { fecha: string }) {
return this.bitacoraMesaService.mesasPorFecha(body.fecha);
}
}