admin funcionando
This commit is contained in:
parent
d95c7ec44c
commit
873683f08f
@ -4,7 +4,13 @@ import {
|
||||
NotFoundException,
|
||||
} from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { FindOptionsWhere, IsNull, Not, Repository } from 'typeorm';
|
||||
import {
|
||||
FindManyOptions,
|
||||
FindOptionsWhere,
|
||||
IsNull,
|
||||
Not,
|
||||
Repository,
|
||||
} from 'typeorm';
|
||||
import { Institucion } from './entity/institucion.entity';
|
||||
import { Operador } from '../operador/entity/operador.entity';
|
||||
|
||||
@ -57,11 +63,7 @@ export class InstitucionService {
|
||||
}
|
||||
|
||||
findMinInfoAll(activo = false, responsable = false): Promise<Institucion[]> {
|
||||
const busqueda: FindOptionsWhere<Institucion> = {};
|
||||
|
||||
if (activo) busqueda.activo = activo;
|
||||
if (responsable) busqueda.responsable = Not(IsNull());
|
||||
return this.repository.find({
|
||||
const options: FindManyOptions<Institucion> = {
|
||||
select: [
|
||||
'id_institucion',
|
||||
'activo',
|
||||
@ -69,9 +71,17 @@ export class InstitucionService {
|
||||
'institucion',
|
||||
'responsable',
|
||||
],
|
||||
where: busqueda,
|
||||
order: { institucion: 'ASC' },
|
||||
});
|
||||
};
|
||||
const busqueda: FindOptionsWhere<Institucion> = {};
|
||||
|
||||
if (activo) busqueda.activo = activo;
|
||||
if (responsable) {
|
||||
busqueda.responsable = Not(IsNull());
|
||||
options.order = { activo: 'DESC', institucion: 'ASC' };
|
||||
}
|
||||
options.where = busqueda;
|
||||
return this.repository.find(options);
|
||||
}
|
||||
|
||||
save(institucion: Institucion): Promise<Institucion> {
|
||||
|
@ -132,7 +132,7 @@ export class OperadorService {
|
||||
return this.fullInformacionOperadorView
|
||||
.findAndCount({
|
||||
where: busqueda,
|
||||
order: { institucion: 'ASC', activo: 'DESC', operador: 'ASC' },
|
||||
order: { activo: 'DESC', institucion: 'ASC', operador: 'ASC' },
|
||||
take: 25,
|
||||
skip: (parseInt(filtros.pagina) - 1) * 25,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user