Se modificaron varias cosas en los endpoint y en algunas entities asi como en los dto
This commit is contained in:
Generated
+30
-2
@@ -243,6 +243,7 @@
|
||||
"integrity": "sha512-2BCOP7TN8M+gVDj7/ht3hsaO/B/n5oDbiAyyvnRlNOs+u1o+JWNYTQrmpuNp1/Wq2gcFrI01JAW+paEKDMx/CA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.27.1",
|
||||
"@babel/generator": "^7.28.3",
|
||||
@@ -2502,6 +2503,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-11.1.6.tgz",
|
||||
"integrity": "sha512-krKwLLcFmeuKDqngG2N/RuZHCs2ycsKcxWIDgcm7i1lf3sQ0iG03ci+DsP/r3FcT/eJDFsIHnKtNta2LIi7PzQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"file-type": "21.0.0",
|
||||
"iterare": "1.2.1",
|
||||
@@ -2549,6 +2551,7 @@
|
||||
"integrity": "sha512-siWX7UDgErisW18VTeJA+x+/tpNZrJewjTBsRPF3JVxuWRuAB1kRoiJcxHgln8Lb5UY9NdvklITR84DUEXD0Cg==",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@nuxt/opencollective": "0.4.1",
|
||||
"fast-safe-stringify": "2.1.1",
|
||||
@@ -2632,6 +2635,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-11.1.6.tgz",
|
||||
"integrity": "sha512-HErwPmKnk+loTq8qzu1up+k7FC6Kqa8x6lJ4cDw77KnTxLzsCaPt+jBvOq6UfICmfqcqCCf3dKXg+aObQp+kIQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"cors": "2.8.5",
|
||||
"express": "5.1.0",
|
||||
@@ -2874,6 +2878,7 @@
|
||||
"integrity": "sha512-27Ov4rm0s2C6LLX+NDXfDVB69LGs8K94sXtFhgeUyQ4DBywZuCgTBu2loCNHRr8JhT9DeQvJM5j9FAu/THbo4w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@swc/counter": "^0.1.3",
|
||||
"@xhmikosr/bin-wrapper": "^13.0.5",
|
||||
@@ -2946,6 +2951,7 @@
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@swc/counter": "^0.1.3",
|
||||
"@swc/types": "^0.1.24"
|
||||
@@ -3320,6 +3326,7 @@
|
||||
"integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@types/estree": "*",
|
||||
"@types/json-schema": "*"
|
||||
@@ -3479,6 +3486,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.5.2.tgz",
|
||||
"integrity": "sha512-FYxk1I7wPv3K2XBaoyH2cTnocQEu8AOZ60hPbsyukMPLv5/5qr7V1i8PLHdl6Zf87I+xZXFvPCXYjiTFq+YSDQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~7.12.0"
|
||||
}
|
||||
@@ -3620,6 +3628,7 @@
|
||||
"integrity": "sha512-VGMpFQGUQWYT9LfnPcX8ouFojyrZ/2w3K5BucvxL/spdNehccKhB4jUyB1yBCXpr2XFm0jkECxgrpXBW2ipoAw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "8.44.0",
|
||||
"@typescript-eslint/types": "8.44.0",
|
||||
@@ -4946,6 +4955,7 @@
|
||||
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
@@ -5004,6 +5014,7 @@
|
||||
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
@@ -5271,6 +5282,7 @@
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz",
|
||||
"integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.4",
|
||||
@@ -5559,6 +5571,7 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"caniuse-lite": "^1.0.30001716",
|
||||
"electron-to-chromium": "^1.5.149",
|
||||
@@ -5866,13 +5879,15 @@
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.5.1.tgz",
|
||||
"integrity": "sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/class-validator": {
|
||||
"version": "0.14.2",
|
||||
"resolved": "https://registry.npmjs.org/class-validator/-/class-validator-0.14.2.tgz",
|
||||
"integrity": "sha512-3kMVRF2io8N8pY1IFIXlho9r8IPUUIfHe2hYVtiebvAzU2XeQFXTv+XI4WX+TnXmtwXMDcjngcpkiPM0O9PvLw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@types/validator": "^13.11.8",
|
||||
"libphonenumber-js": "^1.11.1",
|
||||
@@ -6667,6 +6682,7 @@
|
||||
"integrity": "sha512-QePbBFMJFjgmlE+cXAlbHZbHpdFVS2E/6vzCy7aKlebddvl1vadiC4JFV5u/wqTkNUwEV8WrQi257jf5f06hrg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.8.0",
|
||||
"@eslint-community/regexpp": "^4.12.1",
|
||||
@@ -6728,6 +6744,7 @@
|
||||
"integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"eslint-config-prettier": "bin/cli.js"
|
||||
},
|
||||
@@ -8458,6 +8475,7 @@
|
||||
"integrity": "sha512-Ry+p2+NLk6u8Agh5yVqELfUJvRfV51hhVBRIB5yZPY7mU0DGBmOuFG5GebZbMbm86cdQNK0fhJuDX8/1YorISQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@jest/core": "30.1.3",
|
||||
"@jest/types": "30.0.5",
|
||||
@@ -10466,6 +10484,7 @@
|
||||
"resolved": "https://registry.npmjs.org/passport/-/passport-0.7.0.tgz",
|
||||
"integrity": "sha512-cPLl+qZpSc+ireUvt+IzqbED1cHHkDoVYMo30jbJIdOOjQ1MQYZBPiNvmi8UM6lJuOpTPXJGZQk0DtC4y61MYQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"passport-strategy": "1.x.x",
|
||||
"pause": "0.0.1",
|
||||
@@ -10741,6 +10760,7 @@
|
||||
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"prettier": "bin/prettier.cjs"
|
||||
},
|
||||
@@ -10966,7 +10986,8 @@
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz",
|
||||
"integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==",
|
||||
"license": "Apache-2.0"
|
||||
"license": "Apache-2.0",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/repeat-string": {
|
||||
"version": "1.6.1",
|
||||
@@ -11130,6 +11151,7 @@
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz",
|
||||
"integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==",
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.1.0"
|
||||
}
|
||||
@@ -11976,6 +11998,7 @@
|
||||
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"fast-uri": "^3.0.1",
|
||||
@@ -12349,6 +12372,7 @@
|
||||
"integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@cspotcode/source-map-support": "^0.8.0",
|
||||
"@tsconfig/node10": "^1.0.7",
|
||||
@@ -12509,6 +12533,7 @@
|
||||
"resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.27.tgz",
|
||||
"integrity": "sha512-pNV1bn+1n8qEe8tUNsNdD8ejuPcMAg47u2lUGnbsajiNUr3p2Js1XLKQjBMH0yMRMDfdX8T+fIRejFmIwy9x4A==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@sqltools/formatter": "^1.2.5",
|
||||
"ansis": "^3.17.0",
|
||||
@@ -12730,6 +12755,7 @@
|
||||
"integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
|
||||
"devOptional": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
@@ -13035,6 +13061,7 @@
|
||||
"integrity": "sha512-QaNKAvGCDRh3wW1dsDjeMdDXwZm2vqq3zn6Pvq4rHOEOGSaUMgOOjG2Y9ZbIGzpfkJk9ZYTHpDqgDfeBDcnLaw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@types/eslint-scope": "^3.7.7",
|
||||
"@types/estree": "^1.0.8",
|
||||
@@ -13104,6 +13131,7 @@
|
||||
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"fast-uri": "^3.0.1",
|
||||
|
||||
+13891
-13891
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
numeroCuenta,nombre,licenciatura,correo,fechaInicio,fechaFin,fechaLiberacion,institucion,dependencia,programa,profesor,clave,status
|
||||
315040357,RAMIREZ AVILA MELANY BETSABE,LIC. EN HISTORIA,424018289@pcpuma.acatlan.unam.mx,29/7/2024,3/12/2025,"",Instituto Nacional De Antropologia E Historia,Museo Nacional De Antropologia,"Investigación, conservación y difusión del patrimonio arqueológico y etnográfico de México","",2024-21/7-1471,Pre-Termino
|
||||
319304899,ASCENCIO DIAZ ENRIQUE,LIC. EN ACTUARIA,424018289@pcpuma.acatlan.unam.mx,27/10/2024,1/12/2025,"",UNAM,FES ACATLAN,Acatlán Contigo,Act. Jorge Carmona Mendoza,2025-12/145-24,Cancelado
|
||||
|
+1
-1
@@ -27,7 +27,7 @@ import { AuthModule } from './auth/auth.module';
|
||||
database: process.env.DB_DATABASE,
|
||||
password: process.env.DB_PASSWORD,
|
||||
port: Number(process.env.DB_PORT),
|
||||
synchronize: true,
|
||||
synchronize: false, //Lo ponemos en false para no afectar
|
||||
dropSchema: false,
|
||||
autoLoadEntities: true,
|
||||
logger: 'advanced-console',
|
||||
|
||||
@@ -139,11 +139,11 @@ export class CasoEspecialService {
|
||||
}
|
||||
|
||||
if (nombre) {
|
||||
query.andWhere('usuario.nombre ILIKE :nombre', { nombre: `%${nombre}%` });
|
||||
query.andWhere('usuario.nombre LIKE :nombre', { nombre: `%${nombre}%` });
|
||||
}
|
||||
|
||||
if (numeroCuenta) {
|
||||
query.andWhere('usuario.usuario ILIKE :numeroCuenta', {
|
||||
query.andWhere('usuario.usuario LIKE :numeroCuenta', {
|
||||
numeroCuenta: `%${numeroCuenta}%`,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,12 +8,14 @@ import {
|
||||
Delete,
|
||||
UseGuards,
|
||||
Query,
|
||||
Res,
|
||||
} from '@nestjs/common';
|
||||
import { CuestionarioAlumno2Service } from './cuestionario-alumno2.service';
|
||||
import { CreateCuestionarioAlumno2Dto } from './dto/create-cuestionario-alumno2.dto';
|
||||
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { findCuestionarioAlumno2Dto } from './dto/find.dto';
|
||||
import { Response } from 'express';
|
||||
|
||||
@Controller('cuestionario-alumno2')
|
||||
export class CuestionarioAlumno2Controller {
|
||||
@@ -29,8 +31,10 @@ export class CuestionarioAlumno2Controller {
|
||||
|
||||
@Get()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
findAll(@Query() findDto: findCuestionarioAlumno2Dto) {
|
||||
return this.cuestionarioAlumno2Service.get(findDto.version, findDto.anio);
|
||||
async findAll(@Query() findDto: findCuestionarioAlumno2Dto, @Res() res: Response) {
|
||||
const path = await this.cuestionarioAlumno2Service.get(findDto.version, findDto.anio);
|
||||
|
||||
return res.download(path);
|
||||
}
|
||||
|
||||
// @Get(':id')
|
||||
|
||||
@@ -69,6 +69,7 @@ export class CuestionarioAlumno2Service {
|
||||
return resX;
|
||||
}
|
||||
|
||||
/*
|
||||
async get(version: string, anio: string) {
|
||||
const year = anio;
|
||||
const path = `server/uploads/${year}_cuestionario_alumno.csv`;
|
||||
@@ -106,4 +107,44 @@ export class CuestionarioAlumno2Service {
|
||||
|
||||
return this.archivoService.crearArchivo(path, convertArrayToCSV(data));
|
||||
}
|
||||
*/
|
||||
async get(version: string, anio: string): Promise<string> {
|
||||
const path = `server/uploads/${anio}_cuestionario_alumno.csv`;
|
||||
|
||||
let temp;
|
||||
|
||||
if (version === 'v1') {
|
||||
temp = await this.cuestionarioAlumnoRepository.find({
|
||||
where: {
|
||||
idCuestionarioAlumno: Not(IsNull()),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (version === 'v2') {
|
||||
temp = await this.cuestionarioAlumno2Repository.find({
|
||||
where: {
|
||||
idCuestionarioAlumno2: Not(IsNull()),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (!temp || temp.length === 0) {
|
||||
throw new Error('No hay datos para exportar');
|
||||
}
|
||||
|
||||
const data = temp.map((item) => ({ ...item }));
|
||||
|
||||
await this.archivoService.eliminarArchivo(path).catch(() => null);
|
||||
|
||||
// ✅ Creamos el archivo
|
||||
await this.archivoService.crearArchivo(
|
||||
path,
|
||||
convertArrayToCSV(data),
|
||||
);
|
||||
|
||||
// ✅ SOLO regresamos el path
|
||||
return path;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -272,6 +272,7 @@ ${atentamente}
|
||||
};
|
||||
};
|
||||
|
||||
// Quitamos el module para que podamos exportar normal anteriormente module.export
|
||||
module.exports = {
|
||||
preRegistro,
|
||||
preRegistroRechazadoAlumno,
|
||||
|
||||
@@ -208,6 +208,7 @@ export class ProgramaService {
|
||||
|
||||
const usuario = await this.usuarioRepo.findOne({
|
||||
where: { idUsuario },
|
||||
relations: ['tipoUsuario'], // Se agrego la relacion con tipo de usuario
|
||||
});
|
||||
|
||||
if (!usuario) {
|
||||
|
||||
@@ -26,11 +26,11 @@ export class CrearServicioDto {
|
||||
@IsEmail()
|
||||
correo: string;
|
||||
|
||||
@IsDate()
|
||||
fechaInicio: Date;
|
||||
@IsDateString()
|
||||
fechaInicio: string; // Cambiado a string antes tenia Date
|
||||
|
||||
@IsDate()
|
||||
fechaFin: Date;
|
||||
@IsDateString()
|
||||
fechaFin: string; // Cambiado a string antes tenia Date
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
|
||||
@@ -12,7 +12,7 @@ export class RegistroValidadoDto {
|
||||
idServicio: number;
|
||||
|
||||
@IsOptional()
|
||||
fechaNacimiento?: Date;
|
||||
fechaNacimiento?: string; // Lo pasamos a string antes date
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
|
||||
@@ -20,17 +20,17 @@ export class UpdateServicioDto {
|
||||
@IsOptional()
|
||||
@IsDateString({}, { message: 'fechaInicio debe ser una fecha válida' })
|
||||
//@Type(() => Date)
|
||||
fechaInicio?: Date;
|
||||
fechaInicio?: string; // Lo pasamos a string antes date
|
||||
|
||||
@IsOptional()
|
||||
@IsDateString({}, { message: 'fechaFin debe ser una fecha válida' })
|
||||
//@Type(() => Date)
|
||||
fechaFin?: Date;
|
||||
fechaFin?: string; // Lo pasamos a string antes date
|
||||
|
||||
@IsOptional()
|
||||
@IsDateString({}, { message: 'fechaNacimiento debe ser una fecha válida' })
|
||||
//@Type(() => Date)
|
||||
fechaNacimiento?: Date;
|
||||
fechaNacimiento?: string; // Lo pasamos a string antes date
|
||||
|
||||
@IsOptional()
|
||||
@IsString({ message: 'direccion debe ser texto' })
|
||||
|
||||
@@ -34,19 +34,19 @@ export class Servicio {
|
||||
direccion?: string;
|
||||
|
||||
@Column({ type: 'date' })
|
||||
fechaInicio: Date;
|
||||
fechaInicio: string; // Cambios a tipo string antes tenia date
|
||||
|
||||
@Column({ type: 'date' })
|
||||
fechaFin: Date;
|
||||
fechaFin: string; // Cambios a tipo string antes tenia date
|
||||
|
||||
@Column({ type: 'date', nullable: true, default: null })
|
||||
fechaLiberacion?: Date;
|
||||
fechaLiberacion?: string; // Cambios a tipo string antes tenia date
|
||||
|
||||
@Column({ type: 'date', nullable: true, default: null })
|
||||
fechaNacimiento?: Date;
|
||||
fechaNacimiento?: string; // Cambios a tipo string antes tenia date
|
||||
|
||||
@Column({ type: 'varchar', length: 60 })
|
||||
carpeta: string;
|
||||
carpeta: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 60 })
|
||||
cartaAceptacion: string;
|
||||
|
||||
@@ -83,10 +83,14 @@ export class ServicioController {
|
||||
return res.download(path);
|
||||
}
|
||||
|
||||
// Corregi el endpoint tenia llamando a otrea funcion
|
||||
@Get('reporte')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async generarReporte(@Query() query: any, @Res() res: Response) {
|
||||
const path = await this.servicioService.generarGustavoBazPrada(query.year);
|
||||
async generarReporte(
|
||||
@Query('inicio') inicio: string,
|
||||
@Query('fin') fin: string,
|
||||
@Res() res: Response) {
|
||||
const path = await this.servicioService.generarReporte(inicio, fin);
|
||||
return res.download(path);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,11 @@ import { RegistroValidadoDto } from './dto/registro-validado.dto';
|
||||
import * as fs from 'fs';
|
||||
import { ServiciosAdminDto } from './dto/servicios-admin.dto';
|
||||
import { ServiciosResponsableDto } from './dto/servicios-responsable.dto';
|
||||
import { SendMailDto } from 'src/helpers.services/dto/send-email.dto';
|
||||
import { SendMailDto } from 'src/helpers.services/dto/send-email.dto';
|
||||
const {
|
||||
canceladoAlumno,
|
||||
canceladoResponsable,
|
||||
} = require('./../helpers.services/msjCorreos');
|
||||
|
||||
@Injectable()
|
||||
export class ServicioService {
|
||||
@@ -189,6 +193,7 @@ export class ServicioService {
|
||||
'usuario', // alumno
|
||||
'programa',
|
||||
'programa.usuario', // responsable
|
||||
'status', // Falto agregar la relacion de status
|
||||
],
|
||||
});
|
||||
|
||||
@@ -196,6 +201,11 @@ export class ServicioService {
|
||||
throw new NotFoundException('No existe este Servicio Social.');
|
||||
}
|
||||
|
||||
// Agregamos una validación para el status extra
|
||||
if (!servicio.status) {
|
||||
throw new BadRequestException('El Servicio Social no tiene un estatus válido.');
|
||||
}
|
||||
|
||||
if (servicio.status.idStatus === 10) {
|
||||
throw new BadRequestException('Este Servicio Social ya fue cancelado.');
|
||||
}
|
||||
@@ -422,8 +432,11 @@ export class ServicioService {
|
||||
4,
|
||||
);
|
||||
|
||||
const inicio = moment(`${year}-01-31`).toDate();
|
||||
const fin = moment(`${year + 1}-01-31`).toDate();
|
||||
// Los transformo a string para hacer la consulta
|
||||
//const inicio = moment(`${year}-01-31`).toDate();
|
||||
//const fin = moment(`${year + 1}-01-31`).toDate();
|
||||
const inicio = moment(`${year}-01-31`).format('YYYY-MM-DD');
|
||||
const fin = moment(`${year + 1}-01-31`).format('YYYY-MM-DD');
|
||||
const path: string = `server/uploads/${year}_gustavo_baz_prada.csv`;
|
||||
const data: any[] = [];
|
||||
|
||||
@@ -614,7 +627,7 @@ export class ServicioService {
|
||||
// 🔹 Actualizar el servicio
|
||||
await this.servicioRepo.update(idServicio, {
|
||||
status: { idStatus: 6 },
|
||||
fechaLiberacion: moment().toDate(),
|
||||
fechaLiberacion: moment().format('YYYY-MM-DD'), // lo mismo pasamos a string antes como toDate
|
||||
vistoBuenoAcatlan: vistoBuenoAcatlan ? true : false,
|
||||
});
|
||||
|
||||
@@ -1185,7 +1198,8 @@ export class ServicioService {
|
||||
};
|
||||
}
|
||||
|
||||
async generarReporte(inicio: Date, fin: Date): Promise<string> {
|
||||
// Pasamos el string antes tenia Date
|
||||
async generarReporte(inicio: string, fin: string): Promise<string> {
|
||||
const path = `server/uploads/reporte.csv`;
|
||||
const data: any[] = [];
|
||||
|
||||
@@ -1345,7 +1359,7 @@ export class ServicioService {
|
||||
'status.idStatus',
|
||||
'status.status',
|
||||
])
|
||||
.orderBy('servicio.updatedAt', 'DESC')
|
||||
.orderBy('servicio.createdAt', 'DESC') // Cambiamos el orderBy anteriormente orderBy('servicio.updatedAt', 'DESC')
|
||||
.skip(25 * (pagina - 1))
|
||||
.take(25);
|
||||
|
||||
@@ -1413,9 +1427,6 @@ export class ServicioService {
|
||||
|
||||
// ---- 📆 Validaciones de campos del body ----
|
||||
if (body.correo) dataUpdate.correo = body.correo;
|
||||
if (body.fechaInicio) dataUpdate.fechaInicio = body.fechaInicio;
|
||||
if (body.fechaFin) dataUpdate.fechaFin = body.fechaFin;
|
||||
if (body.fechaNacimiento) dataUpdate.fechaNacimiento = body.fechaNacimiento;
|
||||
if (body.direccion)
|
||||
dataUpdate.direccion = this.validacionService.validarAlfanumerico(
|
||||
body.direccion,
|
||||
@@ -1431,6 +1442,10 @@ export class ServicioService {
|
||||
15,
|
||||
);
|
||||
|
||||
if (body.fechaInicio) dataUpdate.fechaInicio = moment(body.fechaInicio).format('YYYY-MM-DD');
|
||||
if (body.fechaFin) dataUpdate.fechaFin = moment(body.fechaFin).format('YYYY-MM-DD');
|
||||
if (body.fechaNacimiento) dataUpdate.fechaNacimiento = moment(body.fechaNacimiento).format('YYYY-MM-DD');
|
||||
|
||||
if (this.validacionService.validarObjetoVacio(dataUpdate)) {
|
||||
throw new BadRequestException(
|
||||
'No se envió nada para actualizar este Servicio Social.',
|
||||
|
||||
@@ -66,7 +66,9 @@ export class UsuarioService {
|
||||
let response;
|
||||
try {
|
||||
if (process.env.MODE == 'pruebas') {
|
||||
response = new Promise((res) => {
|
||||
/*
|
||||
Quitamos la promesa ya que muestra un error
|
||||
response = new Promise((res) => {
|
||||
res({
|
||||
data: {
|
||||
nombre: 'nombre',
|
||||
@@ -75,6 +77,14 @@ export class UsuarioService {
|
||||
},
|
||||
});
|
||||
});
|
||||
*/
|
||||
response = {
|
||||
data: {
|
||||
nombre: 'nombre',
|
||||
carrconst: 'Carrera',
|
||||
avance: '80',
|
||||
},
|
||||
};
|
||||
} else {
|
||||
response = await axios.post(
|
||||
`${process.env.ESCOLARES}${numeroDeCuenta}`,
|
||||
|
||||
Reference in New Issue
Block a user