sin infraccion

This commit is contained in:
Lemuel
2022-08-25 19:16:45 -05:00
parent 0a2e17e9e0
commit 2cbb13aff5
4 changed files with 112 additions and 6 deletions
@@ -4,7 +4,7 @@ import {
NotFoundException,
} from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { Not, Repository } from 'typeorm';
import { Infraccion } from './entity/infraccion.entity';
import { InstitucionInfraccion } from './entity/institucion-infraccion.entity';
import { Operador } from '../operador/entity/operador.entity';
@@ -45,7 +45,10 @@ export class InstitucionInfraccionService {
}
findAll() {
return this.infraccionRepository.find({ order: { infraccion: 'ASC' } });
return this.infraccionRepository.find({
where: { id_infraccion: Not(1) },
order: { infraccion: 'ASC' },
});
}
findAllByIdInstitucion(id_institucion: number) {
@@ -54,12 +57,12 @@ export class InstitucionInfraccionService {
.then((institucion) =>
this.institucionInfraccionRepository
.createQueryBuilder('ii')
.innerJoinAndSelect('ii.infraccion', 'i')
.innerJoinAndSelect('ii.institucion', 'in')
.where('in.id_institucion = :id_institucion', {
.innerJoinAndSelect('ii.infraccion', 'inf')
.innerJoinAndSelect('ii.institucion', 'i')
.where('i.id_institucion = :id_institucion && inf.id_infraccion != 1', {
id_institucion: institucion.id_institucion,
})
.orderBy('i.infraccion')
.orderBy('inf.infraccion')
.getMany(),
);
}