Entidades y Realciones(Falta enrutar bien 4

This commit is contained in:
TioSam77
2024-06-17 15:49:09 -06:00
parent 6af77f90eb
commit ecb55beeaf
2 changed files with 6 additions and 21 deletions
+2 -10
View File
@@ -9,11 +9,9 @@ export class ProfesorFilterDto {
@IsInt()
id_categoria?: number;
/*
@IsOptional()
@IsString()
num_trabajador?: string;
*/
@IsInt()
id_carrera?: number;
@IsOptional()
@IsString()
@@ -30,10 +28,4 @@ export class ProfesorFilterDto {
@IsOptional()
@IsBoolean()
activo?: boolean;
/*
@IsOptional()
@IsBoolean()
mostrar?: boolean;
*/
}
+4 -11
View File
@@ -56,7 +56,7 @@ export class ProfesorService {
return { message: 'Profesor removed successfully' };
}
//brings teachers by id
//brings teachers by id
async profile(id_profesor: number) {
const profesor = await this.profesorRepository.findOne({ where: { id_profesor } });
if (!profesor) {
@@ -78,11 +78,10 @@ export class ProfesorService {
query.andWhere('profesor.id_categoria = :id_categoria', { id_categoria: filterDto.id_categoria });
}
/*
if (filterDto.num_trabajador) {
query.andWhere('profesor.num_trabajador like :num_trabajador', { num_trabajador: `%${filterDto.num_trabajador}%` });
if (filterDto.id_carrera !== undefined) {
query.innerJoin('profesor.asignaturaCarreraProfesores', 'acp')
.andWhere('acp.id_carrera = :id_carrera', { id_carrera: filterDto.id_carrera });
}
*/
if (filterDto.extension) {
query.andWhere('profesor.extension like :extension', { extension: `%${filterDto.extension}%` });
@@ -100,12 +99,6 @@ export class ProfesorService {
query.andWhere('profesor.activo = :activo', { activo: filterDto.activo });
}
/*
if (filterDto.mostrar !== undefined) {
query.andWhere('profesor.mostrar = :mostrar', { mostrar: filterDto.mostrar });
}
*/
return query.getMany();
}
}