fixed contar_tipoEquipos and get user
This commit is contained in:
@@ -438,21 +438,27 @@ export class EquipoService {
|
||||
|
||||
async contar_tipoEquipos_tipoUso(estado: string[]): Promise<any> {
|
||||
try {
|
||||
const count = await this.equipoRepository
|
||||
const result = await this.equipoRepository
|
||||
.createQueryBuilder('e')
|
||||
.innerJoin('e.tipoEquipo', 't') // une la tabla usuario
|
||||
.innerJoin('e.tipoUso', 'u') // une la tabla categoria
|
||||
.innerJoin('e.tipoEquipo', 't')
|
||||
.innerJoin('e.tipoUso', 'u')
|
||||
.innerJoin('e.sistemaOperativo', 'so')
|
||||
.innerJoin('e.estado', 'es')
|
||||
.select(['u.tipo_uso AS uso', 't.tipo_equipo AS categoria'])
|
||||
.select([
|
||||
't.tipo_equipo AS tipo_equipo',
|
||||
'u.tipo_uso AS tipo_uso',
|
||||
'so.sistema_operativo AS sistema_operativo',
|
||||
])
|
||||
.addSelect('COUNT(*) AS total')
|
||||
.andWhere('es.estado IN (:...estado)', { estado })
|
||||
.where('es.estado IN (:...estado)', { estado })
|
||||
.groupBy('t.id_tipo_de_equipo')
|
||||
.addGroupBy('u.id_uso')
|
||||
.addGroupBy('so.id_sistema_operativo')
|
||||
.getRawMany();
|
||||
|
||||
return count;
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error('Error al contar equipos por tipo y uso:', error);
|
||||
console.error('Error al contar equipos por tipo, uso y SO:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ export class MovimientoService {
|
||||
const movimiento = await this.movimientoRepo.findOne({
|
||||
where: { equipo: { id_equipo: idEquipo } },
|
||||
order: { fechaMovimiento: 'DESC' },
|
||||
relations:['user'],
|
||||
});
|
||||
|
||||
return movimiento;
|
||||
|
||||
Reference in New Issue
Block a user