2026-01-13 19:12:45 -06:00
|
|
|
import { Injectable, NotFoundException } from '@nestjs/common';
|
2025-10-02 17:03:25 -06:00
|
|
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
|
|
|
import { Repository } from 'typeorm';
|
|
|
|
|
import { Equipo } from './entities/equipo.entity';
|
2025-09-24 18:37:56 -06:00
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
|
export class EquipoService {
|
2025-10-02 17:03:25 -06:00
|
|
|
constructor(@InjectRepository(Equipo)
|
|
|
|
|
private readonly equipoRepository: Repository<Equipo>){}
|
2025-09-24 18:37:56 -06:00
|
|
|
|
|
|
|
|
findAll() {
|
2025-10-02 17:03:25 -06:00
|
|
|
return this.equipoRepository.find();
|
2025-09-24 18:37:56 -06:00
|
|
|
}
|
|
|
|
|
|
2026-01-13 19:12:45 -06:00
|
|
|
async findOne(id_equipo: number):Promise<Equipo> {
|
|
|
|
|
const equipo = await this.equipoRepository.findOne({where:{id_equipo}})
|
|
|
|
|
if(!equipo){
|
|
|
|
|
throw new NotFoundException("not found");
|
|
|
|
|
}
|
|
|
|
|
return equipo;
|
2025-09-24 18:37:56 -06:00
|
|
|
}
|
|
|
|
|
}
|
2025-10-03 16:34:39 -06:00
|
|
|
//IO
|