Modificaciones en algunos endpoint y correcion de erroes
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,6 @@
|
||||
numeroCuenta,nombre,licenciatura,correo,fechaInicio,fechaFin,fechaLiberacion,institucion,dependencia,programa,profesor,clave,status
|
||||
413076379,JIMENEZ GONZALEZ JAZMIN ALEJANDRA,LIC. EN MATEMATICAS APLICADAS Y COMP.,424018289@pcpuma.acatlan.unam.mx,1/12/2025,4/12/2025,"",UNAM,FES ACATLAN,Acatlán Contigo,xxxx,2025-12/145-24,Pre-Registro
|
||||
319302187,PEREZ CENTENO JORGE,LIC. EN CIENCIAS POLITICAS Y ADMON PUB,pcentenojorge15@gmail.com,1/12/2025,8/12/2025,"",UNAM,FES ACATLAN,Acatlán Contigo,Antonio Faustino Torres,2025-12/145-24,Pre-Registro
|
||||
413076379,JIMENEZ GONZALEZ JAZMIN ALEJANDRA,LIC. EN MATEMATICAS APLICADAS Y COMP.,lucel21@hotmail.com,1/12/2025,4/12/2025,"",UNAM,FES ACATLAN,Acatlán Contigo,xxxx,2025-12/145-24,Pre-Registro
|
||||
421162888,DREW IBARRA EDUARDO CARLOS,LIC. ENSEÑANZA DE ESPAÑOL(LENG. EXTRANJ),424018289@pcpuma.acatlan.unam.mx,17/12/2025,11/12/2025,"",UNIVERSIDAD NACIONAL AUTONOMA DE MEXICO,ESCUELA DE EXTENSIÓN EN CHICAGO,Enseñanza de Español como Lengua Extranjera,"",2024-12/226-2509,Pre-Termino
|
||||
419089577,GUTIERREZ GUTIERREZ DIANA ANGELICA,LIC. EN ARQUITECTURA,320154041@pcpuma.acatlan.unam.mx,19/12/2025,18/6/2026,"",UNAM,FES ACATLAN,Titulación por servicio social,LIC. MARCELA MARTÍNEZ RANGEL,2023-12/20-222,Cancelado
|
||||
422116468,CONTRERAS GONZALEZ ANA CRISTINA,LIC. EN ECONOMIA,424018289@pcpuma.acatlan.unam.mx,28/12/2025,"","",Secretaria De Agricultura Y Desarrollo Rural,Liconsa. S.a De C.v.,SERVICIO SOCIAL LICONSA OFICINA CENTRAL,"",2025-192/1-2689,Pre-Registro
|
||||
|
||||
|
@@ -31,16 +31,25 @@ export class CuestionarioPrograma2Service {
|
||||
|
||||
let servicio = await this.servicioRepository.findOne({
|
||||
where: { idServicio },
|
||||
relations: ['cuestionarioPrograma2', 'status'],
|
||||
});
|
||||
if (!servicio) {
|
||||
throw new Error('No existe este Servicio Social.');
|
||||
}
|
||||
if (servicio.cuestionarioPrograma2.idCuestionarioPrograma2) {
|
||||
|
||||
if (servicio.cuestionarioPrograma2) {
|
||||
throw new Error(
|
||||
'Este Servicio Social ya cuenta con cuestionario de alumno',
|
||||
'Este Servicio Social ya cuenta con cuestionario de programa',
|
||||
);
|
||||
}
|
||||
|
||||
// Esta validacion esta incorrecta la cambie por la linea de arriva
|
||||
// if (servicio.cuestionarioPrograma2.idCuestionarioPrograma2) {
|
||||
// throw new Error(
|
||||
// 'Este Servicio Social ya cuenta con cuestionario de alumno',
|
||||
// );
|
||||
// }
|
||||
|
||||
console.log('el servicio social si existe', servicio);
|
||||
|
||||
console.log('antes de create ques2');
|
||||
|
||||
@@ -133,10 +133,11 @@ import {
|
||||
@Length(1, 50)
|
||||
p3_D_5: string;
|
||||
|
||||
// Elimine esta tabla por que no existe en el cuestionario => Verificar si se ocupa en otro cuestionario ?
|
||||
// Sección p3_E
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@Length(1, 50)
|
||||
p3_E_1: string;
|
||||
// @IsString()
|
||||
// @IsNotEmpty()
|
||||
// @Length(1, 50)
|
||||
// p3_E_1: string;
|
||||
}
|
||||
|
||||
@@ -146,6 +146,7 @@ export class ServicioController {
|
||||
@Body('data') dataJson: string,
|
||||
) {
|
||||
const body = JSON.parse(dataJson);
|
||||
console.log("file", file);
|
||||
return this.servicioService.subirCartaTermino(body.idServicio, file);
|
||||
}
|
||||
|
||||
|
||||
@@ -361,17 +361,32 @@ export class ServicioService {
|
||||
'id servicio',
|
||||
);
|
||||
|
||||
// Agregue estas lineas
|
||||
if (!archivo) {
|
||||
throw new BadRequestException('No se recibió el archivo');
|
||||
}
|
||||
|
||||
if (archivo.mimetype !== 'application/pdf') {
|
||||
throw new BadRequestException('El archivo debe ser PDF');
|
||||
}
|
||||
|
||||
const rutaArchivo = `./server/uploads/${archivo.originalname}`;
|
||||
// Hasta aqui termine de agregar las lineas
|
||||
|
||||
// 🔹 Validar archivo y generar path local
|
||||
const rutaArchivo: string = `./server/uploads/${this.validacionService.validacionBasicaStr(
|
||||
archivo,
|
||||
'archivo',
|
||||
true,
|
||||
1000,
|
||||
)}`;
|
||||
// const rutaArchivo: string = `./server/uploads/${this.validacionService.validacionBasicaStr(
|
||||
// archivo,
|
||||
// 'archivo',
|
||||
// true,
|
||||
// 1000,
|
||||
// )}`;
|
||||
|
||||
// 🔹 Buscar servicio
|
||||
const servicio = await this.servicioRepo.findOne({
|
||||
where: { idServicio },
|
||||
relations: {
|
||||
status: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!servicio) {
|
||||
@@ -1321,6 +1336,7 @@ export class ServicioService {
|
||||
.createQueryBuilder('servicio')
|
||||
.innerJoinAndSelect('servicio.usuario', 'usuario')
|
||||
.leftJoinAndSelect('usuario.tipoUsuario', 'tipoUsuario')
|
||||
.leftJoinAndSelect('servicio.cuestionarioPrograma2', 'cuestionarioPrograma2') // Agregue esta linea para tener la relacion y poder jalar la infromacion
|
||||
.innerJoinAndSelect('servicio.programa', 'programa')
|
||||
.innerJoinAndSelect('servicio.carrera', 'carrera')
|
||||
.innerJoinAndSelect('servicio.status', 'status')
|
||||
@@ -1354,6 +1370,7 @@ export class ServicioService {
|
||||
'carrera.carrera',
|
||||
'status.idStatus',
|
||||
'status.status',
|
||||
'cuestionarioPrograma2.idCuestionarioPrograma2', // Agrgue esta linea para tener la infromacion de la ralacion
|
||||
])
|
||||
.orderBy('servicio.createdAt', 'DESC') // Cambiamos el orderBy anteriormente orderBy('servicio.updatedAt', 'DESC')
|
||||
.skip(25 * (pagina - 1))
|
||||
@@ -1362,8 +1379,23 @@ export class ServicioService {
|
||||
// 5️⃣ Ejecutar y obtener datos + total
|
||||
const [rows, count] = await query.getManyAndCount();
|
||||
|
||||
// Agregue una validacion para el cuestionario de responsable
|
||||
const serviciosResponsable = rows.map((servicio) => ({
|
||||
...servicio,
|
||||
cuestionarioCompletado: Boolean(servicio.cuestionarioPrograma2),
|
||||
}));
|
||||
|
||||
// Agregamos temporalmente para verificar que funcione
|
||||
console.log(
|
||||
serviciosResponsable.map(s => ({
|
||||
idServicio: s.idServicio,
|
||||
cuestionarioCompleto: s.cuestionarioCompletado,
|
||||
}))
|
||||
)
|
||||
|
||||
// 6️⃣ Retornar resultado en el mismo formato que antes
|
||||
return { count, serviciosResponsable: rows };
|
||||
// return { count, serviciosResponsable: rows };
|
||||
return { count, serviciosResponsable };
|
||||
}
|
||||
|
||||
async update(
|
||||
|
||||
Reference in New Issue
Block a user