hoy endpoint
This commit is contained in:
@@ -45,7 +45,10 @@ export class InstitucionProgramaService {
|
||||
}
|
||||
|
||||
findAllProgramas() {
|
||||
return this.programaRepository.find();
|
||||
return this.programaRepository.find({
|
||||
where: { id_programa: Not(1) },
|
||||
order: { programa: 'ASC' },
|
||||
});
|
||||
}
|
||||
|
||||
findById(id_institucion_programa: number) {
|
||||
@@ -75,17 +78,19 @@ export class InstitucionProgramaService {
|
||||
|
||||
async findAllByIdInstitucion(id_institucion: number, mostrar = false) {
|
||||
const institucion = await this.institucionService.findById(id_institucion);
|
||||
const busqueda: {
|
||||
institucion: Institucion;
|
||||
programa: { id_programa: FindOperator<number> };
|
||||
mostrar?: boolean;
|
||||
} = {
|
||||
institucion,
|
||||
programa: { id_programa: Not(1) },
|
||||
};
|
||||
const query = this.institucionProgramaRepository
|
||||
.createQueryBuilder('ip')
|
||||
.innerJoinAndSelect('ip.programa', 'p', 'p.id_programa != 1')
|
||||
.innerJoinAndSelect(
|
||||
'ip.institucion',
|
||||
'i',
|
||||
'i.id_institucion = :id_institucion',
|
||||
{ id_institucion: institucion.id_institucion },
|
||||
)
|
||||
.orderBy('p.programa');
|
||||
|
||||
if (mostrar) busqueda.mostrar = mostrar;
|
||||
return this.institucionProgramaRepository.find(busqueda);
|
||||
if (mostrar) query.andWhere('ip.mostrar = 1');
|
||||
return query.getMany();
|
||||
}
|
||||
|
||||
update(attrs: Partial<InstitucionPrograma>) {
|
||||
|
||||
Reference in New Issue
Block a user