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

81 lines
2.5 KiB
TypeScript
Raw Normal View History

2026-01-23 16:46:55 -06:00
import {
Controller,
Get,
Post,
Body,
Patch,
Param,
2026-02-23 18:16:17 -06:00
UseGuards,
2026-01-23 16:46:55 -06:00
} from '@nestjs/common';
2026-01-21 15:13:21 -06:00
import { BitacoraMesaService } from './bitacora_mesa.service';
2026-02-17 19:21:29 -06:00
import { CreateBitacoraMesaDto, FindByDate } from './dto/create-bitacora_mesa.dto';
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';
2026-01-21 15:13:21 -06:00
@Controller('bitacora-mesa')
export class BitacoraMesaController {
2026-02-17 19:21:29 -06:00
constructor(private readonly bitacoraMesaService: BitacoraMesaService) { }
2026-01-21 15:13:21 -06:00
2026-03-02 14:49:15 -06:00
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
2026-01-21 15:13:21 -06:00
@Post()
2026-01-28 12:51:55 -06:00
assignment(@Body() createBitacoraMesaDto: CreateBitacoraMesaDto) {
return this.bitacoraMesaService.assignment(createBitacoraMesaDto);
2026-01-21 15:13:21 -06:00
}
2026-03-02 14:49:15 -06:00
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
2026-01-21 15:13:21 -06:00
@Get()
findAll() {
return this.bitacoraMesaService.findAll();
}
2026-03-02 14:49:15 -06:00
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
2026-01-21 15:13:21 -06:00
@Get(':id')
findOne(@Param('id') id: string) {
return this.bitacoraMesaService.findOne(+id);
}
2026-01-23 16:46:55 -06:00
2026-03-02 14:49:15 -06:00
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
2026-01-23 16:46:55 -06:00
@Get('/cuenta/:id_cuenta')
findByCuenta(@Param('id_cuenta') id_cuenta: string) {
return this.bitacoraMesaService.findByCuenta(+id_cuenta);
}
2026-01-28 12:51:55 -06:00
2026-03-02 14:49:15 -06:00
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
2026-01-29 11:13:00 -06:00
@Get('/table/:id_mesa')
findByTable(@Param('id_mesa') id_mesa: number) {
return this.bitacoraMesaService.findByTable(id_mesa);
}
2026-03-02 14:49:15 -06:00
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
2026-02-17 19:21:29 -06:00
@Post('/date')
findByDate(@Body() data: FindByDate) {
return this.bitacoraMesaService.findByDate(data.date);
}
2026-03-02 14:49:15 -06:00
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
2026-01-28 12:51:55 -06:00
@Patch('cancelar/:id')
cancelationByMachine(
@Param('id') id: number,
@Body('tiempo_asignado') tiempo_asignado: number,
) {
return this.bitacoraMesaService.cancelation(id, tiempo_asignado);
}
2026-02-19 10:49:09 -06:00
2026-03-02 14:49:15 -06:00
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
2026-02-19 10:49:09 -06:00
@Post('mesas-por-dia')
mesasPorDia(@Body() body: { fecha: string }) {
return this.bitacoraMesaService.mesasPorFecha(body.fecha);
}
2026-01-21 15:13:21 -06:00
}