fixing [200~findByCuenta~

This commit is contained in:
2026-01-23 20:09:52 -06:00
parent 90e4aa9810
commit 3b947fe95a
3 changed files with 42 additions and 24 deletions
+12 -6
View File
@@ -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);
}
+20
View File
@@ -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 },