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

43 lines
1.0 KiB
TypeScript
Raw Normal View History

2026-02-23 18:16:17 -06:00
import { Controller, Body, Patch, Param, Get, UseGuards } from '@nestjs/common';
2025-09-22 18:09:41 -06:00
import { MesaService } from './mesa.service';
import { UpdateMesaDto } from './dto/update-mesa.dto';
2026-02-23 18:16:17 -06:00
import { JwtAuthGuard } from 'src/user/jwt.guard';
2025-09-22 18:09:41 -06:00
@Controller('mesa')
export class MesaController {
2026-02-05 16:15:05 -06:00
constructor(private readonly mesaService: MesaService) { }
2025-09-22 18:09:41 -06:00
2026-02-23 18:16:17 -06:00
@UseGuards(JwtAuthGuard)
2026-01-21 15:13:21 -06:00
@Get()
2025-09-22 18:09:41 -06:00
async findAll() {
return this.mesaService.findAll();
}
2026-02-23 18:16:17 -06:00
@UseGuards(JwtAuthGuard)
2026-01-13 19:12:45 -06:00
@Get('activo')
async findAllActivo() {
return this.mesaService.findAllActivo();
}
2026-02-05 16:16:13 -06:00
2026-02-25 13:01:34 -06:00
@UseGuards(JwtAuthGuard)
2026-02-24 18:47:49 -06:00
@Get('uso')
async findActiveMesas() {
return this.mesaService.findActiveMesas();
}
2026-02-23 18:16:17 -06:00
@UseGuards(JwtAuthGuard)
2025-09-22 18:09:41 -06:00
@Patch(':id')
async updateActivo(
@Param('id') id: number,
@Body() updateMesaDto: UpdateMesaDto,
) {
return this.mesaService.updateActivo(id, updateMesaDto);
}
2026-02-05 16:15:05 -06:00
2026-02-23 18:16:17 -06:00
@UseGuards(JwtAuthGuard)
2026-02-05 16:15:05 -06:00
@Patch(':id/activo')
toggleActivo(@Param('id') id: number) {
return this.mesaService.toggleActivo(+id);
}
2025-09-22 18:09:41 -06:00
}