fixing [200~findByCuenta~
This commit is contained in:
@@ -26,24 +26,16 @@ export class BitacoraMesaService {
|
||||
}
|
||||
|
||||
async findByCuenta(id_cuenta: number) {
|
||||
const alumno = await this.bitacoraMesaRepository.findOne({
|
||||
where: {
|
||||
alumno_inscrito: {
|
||||
alumno: {
|
||||
id_cuenta: id_cuenta,
|
||||
},
|
||||
},
|
||||
},
|
||||
relations: {
|
||||
alumno_inscrito: {
|
||||
alumno: true,
|
||||
},
|
||||
mesa: true,
|
||||
},
|
||||
order: {
|
||||
tiempo_entrada: 'DESC',
|
||||
},
|
||||
});
|
||||
const alumno = await this.bitacoraMesaRepository
|
||||
.createQueryBuilder('bitacora')
|
||||
.leftJoinAndSelect('bitacora.alumno_inscrito', 'alumnoInscrito')
|
||||
.leftJoinAndSelect('alumnoInscrito.alumno', 'alumno')
|
||||
.leftJoinAndSelect('alumno.carrera', 'carrera')
|
||||
.leftJoinAndSelect('bitacora.mesa', 'mesa')
|
||||
.where('alumno.id_cuenta = :id_cuenta', { id_cuenta })
|
||||
.orderBy('bitacora.tiempo_entrada', 'DESC')
|
||||
.getOne();
|
||||
|
||||
if (!alumno) {
|
||||
throw new NotFoundException('alumno sin mesa');
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Param,
|
||||
} from '@nestjs/common';
|
||||
import { Controller, Get, Param } from '@nestjs/common';
|
||||
import { EquipoService } from './equipo.service';
|
||||
import { Equipo } from './entities/equipo.entity';
|
||||
|
||||
@@ -15,8 +11,18 @@ export class EquipoController {
|
||||
return this.equipoService.findAll();
|
||||
}
|
||||
|
||||
@Get('/active')
|
||||
findActive() {
|
||||
return this.equipoService.findActive();
|
||||
}
|
||||
|
||||
@Get('/disable')
|
||||
findDisable() {
|
||||
return this.equipoService.findDisable();
|
||||
}
|
||||
|
||||
@Get('/student/:id')
|
||||
findOnlyUsable(@Param('id')id:number): Promise<Equipo[]> {
|
||||
findOnlyUsable(@Param('id') id: number): Promise<Equipo[]> {
|
||||
return this.equipoService.findOnlyUsable(+id);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,26 @@ export class EquipoService {
|
||||
});
|
||||
}
|
||||
|
||||
findActive() {
|
||||
return this.equipoRepository
|
||||
.createQueryBuilder('equipo')
|
||||
.where('equipo.activo = :activo', { activo: 1 })
|
||||
.innerJoinAndSelect('equipo.plataforma', 'p')
|
||||
.innerJoinAndSelect('equipo.areaUbicacion', 'a')
|
||||
.orderBy('equipo.ubicacion', 'ASC')
|
||||
.getMany();
|
||||
}
|
||||
|
||||
findDisable() {
|
||||
return this.equipoRepository
|
||||
.createQueryBuilder('equipo')
|
||||
.where('equipo.activo = :activo', { activo: 0 })
|
||||
.innerJoinAndSelect('equipo.plataforma', 'p')
|
||||
.innerJoinAndSelect('equipo.areaUbicacion', 'a')
|
||||
.orderBy('equipo.ubicacion', 'ASC')
|
||||
.getMany();
|
||||
}
|
||||
|
||||
async findOne(id_equipo: number): Promise<Equipo> {
|
||||
const equipo = await this.equipoRepository.findOne({
|
||||
where: { id_equipo },
|
||||
|
||||
Reference in New Issue
Block a user