fixed ep mesa
This commit is contained in:
@@ -21,13 +21,13 @@ export class AlumnoController {
|
||||
return this.alumnoService.create(createStudentDto);
|
||||
}
|
||||
|
||||
//@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get(':id')
|
||||
findOneWhitSancion(@Param('id') id: number) {
|
||||
return this.alumnoService.findOneWhitSancion(+id);
|
||||
}
|
||||
|
||||
//@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get('sancion/:id')
|
||||
findOne(@Param('id') id: number) {
|
||||
return this.alumnoService.findOne(+id);
|
||||
|
||||
@@ -38,15 +38,42 @@ export class MesaService {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
async findAll(): Promise<Mesa[]> {
|
||||
return await this.mesaRepository.find();
|
||||
}
|
||||
|
||||
|
||||
async findAllActivo(): Promise<Mesa[]> {
|
||||
return await this.mesaRepository.find({ where: { activo: true } });
|
||||
const mesas = await this.mesaRepository
|
||||
.createQueryBuilder('mesa')
|
||||
|
||||
.andWhere('mesa.activo = true')
|
||||
|
||||
.andWhere((qb) => {
|
||||
const subQuery = qb
|
||||
.subQuery()
|
||||
.select('bitacora_mesa.id_mesa')
|
||||
.from('bitacora_mesa', 'bitacora_mesa')
|
||||
.where(
|
||||
`TIMESTAMPDIFF(
|
||||
SECOND,
|
||||
NOW(),
|
||||
DATE_ADD(bitacora_mesa.tiempo_entrada, INTERVAL bitacora_mesa.tiempo_asignado MINUTE)
|
||||
) > 0`,
|
||||
)
|
||||
.getQuery();
|
||||
|
||||
return `mesa.id_mesa NOT IN ${subQuery}`;
|
||||
})
|
||||
|
||||
.orderBy('mesa.id_mesa', 'ASC')
|
||||
|
||||
.getMany();
|
||||
|
||||
if (!mesas.length) {
|
||||
throw new NotFoundException('No usable table found');
|
||||
}
|
||||
|
||||
return mesas;
|
||||
}
|
||||
|
||||
async updateActivo(id: number, updateMesaDto: UpdateMesaDto) {
|
||||
|
||||
Reference in New Issue
Block a user