32 Commits

Author SHA1 Message Date
evenegas 2574b2bf86 Se agregó endpoint para crear usuarios admin 2025-09-17 11:57:47 -06:00
evenegas 0d0cc8f53d Se agregó endpoint para crear usuarios admin 2025-09-17 10:53:45 -06:00
evenegas 1c821addfb Se agregó endpoint para crear usuarios admin 2025-09-17 10:50:35 -06:00
evenegas 0c48921a9b se puso el transporter de gmail 2025-05-05 13:38:23 -06:00
evenegas 3ba883ef5d mensaje de pull a master
erge branch 'master' of https://repositorio.acatlan.unam.mx/CIDWA/servicio_social_api into dev
2025-05-05 13:35:41 -06:00
stern b2ce341ef1 Cambio a código en archivo server/helper/gmail.js para envío de correos con Relay SMTP 2025-04-30 11:49:47 -06:00
Your Name cfd2202dfe using nodemaler and stmp 2025-04-29 17:14:52 -06:00
Your Name 573471a33d update y password registro pruebas 2025-02-27 15:38:46 -06:00
eithan f7763a62e4 Merge pull request 'dev' (#2) from dev into master
Reviewed-on: #2
2025-02-21 11:57:17 -06:00
Your Name 4deb3e9093 change pass hashed, verificarToken 2025-02-21 11:53:52 -06:00
Your Name 5aef8dac66 remove cuestionario from all project. answers validated, time error reports 2025-02-17 09:37:37 -06:00
Your Name 8a24c4368b actualizar cuestionario a text, error de largo de sql, cambiar tabla de get cuestionarios programa 2025-02-14 13:13:41 -05:00
Your Name 7bef28e60f using cuestionario2 has atribute, create credentials for testing 2025-02-13 13:57:28 -05:00
Tu Nombre f89b7e05db devcontainer 2025-02-10 12:06:48 -06:00
Tu Nombre 7e29a5e5b4 escolares 2025-02-07 18:07:41 -06:00
Tu Nombre f6dc38c00f cambios de cedetec, pruebas 2025-02-05 16:36:01 -06:00
Tu Nombre 38afeb084a validar cuestionario y comentar el envio de correos de gmail para evitar errores 2025-01-30 14:57:09 -06:00
Tu Nombre 76092c627f hello message updated 2025-01-30 10:47:21 -06:00
Tu Nombre 87c311c0c8 nuevo mensaje token 2025-01-30 10:37:57 -06:00
Tu Nombre c547f25a0a probando ver si pide token 2025-01-30 10:03:04 -06:00
Tu Nombre 8cc4c7d34f solo un log antes de la ufnc 2025-01-29 13:33:53 -06:00
Tu Nombre ab21808ec8 test error drive 2025-01-29 10:23:57 -06:00
Tu Nombre 3a3c279080 controller correcto 2025-01-29 09:08:11 -06:00
Tu Nombre f1d041e891 tablas y controllers actualizados de cuestionarios 2025-01-28 12:22:19 -06:00
Tu Nombre d181790277 route y controller de los cuestionarios, aun en desarrollo 2025-01-28 12:10:52 -06:00
Tu Nombre 493fd83e0e agregar los modelos Cuestioanrio, cuestionarioAlumno2, cuestionarioPrograma2 2025-01-28 10:20:37 -06:00
LeydiMoon 27988f9235 Merge pull request 'master' (#1) from master into dev
Reviewed-on: #1
2024-10-03 13:31:20 -06:00
Lemuel Márquez 329332ad97 listo cambios 2023-07-25 17:47:52 -06:00
Lemuel Márquez 73b88b5fde Merge branch 'master' into dev 2023-07-25 16:20:48 -06:00
xXpuma99Xx 67a23bcef0 update servicio actualizar status si se manda carta termino o informe global 2022-01-18 06:45:12 -06:00
xXpuma99Xx 3b18b3a8c2 corregido 2022-01-17 18:56:54 -06:00
xXpuma99Xx bc146595a9 querries traen solo lo que necesitan 2022-01-17 18:28:01 -06:00
54 changed files with 2917 additions and 297 deletions
+16
View File
@@ -0,0 +1,16 @@
{
"name": "Servicio Social API",
"dockerFile": "../Dockerfile",
"appPort": [3000],
"postCreateCommand": "npm install",
"extensions": [
"dbaeumer.vscode-eslint",
"ms-azuretools.vscode-docker",
"esbenp.prettier-vscode"
],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"remoteUser": "node"
}
+1
View File
@@ -3,3 +3,4 @@ node_modules/
cred.json cred.json
server/uploads/* server/uploads/*
#.devcontainer
+20
View File
@@ -0,0 +1,20 @@
# Usa una imagen base de Node.js
FROM node:16
# Establece el directorio de trabajo dentro del contenedor
WORKDIR /usr/src/app
# Copia los archivos de package.json y package-lock.json (si existe)
COPY package*.json ./
# Instala las dependencias
RUN npm install
# Copia el código fuente de la aplicación
COPY . .
# Expone el puerto que la app usará
EXPOSE 3000
# Comando por defecto para ejecutar la aplicación en desarrollo
CMD ["npm", "run", "dev"]
+70
View File
@@ -0,0 +1,70 @@
# Documentacion del sistema IRIS
Tipos de usuarios
| 1 | admin |
| 2 | responsable |
| 3 | alumno |
| 4 | casoEspecial
cuando se registran los admin?
cuando se carga la base se sube al admin - COESI
los responsables se suben por carga m asiva en un csv
En testeo se sube un responsable al instalar la db
existen responsables internos y externos
programsa admin
- son los programas que tiene asignados un administrador
Ejemplo
Acatlan contigo -
las claves de programa las sube coesi, que previamente se registro en otro ssitema y se guarda en iris
el responsable registra a los alumnos
status del servicio social
'Pre-Registro',
'Pre-Registro Validado',
'Registro',
'Pre-Termino',
'Termino',
'Liberación',
'Carta Aceptación Rechazada',
'Carta Termino Rechazada',
'Informe Global Rechazado',
'Cancelado',
'Articulo 52',
'Articulo 91',
'Liberación Articulo 52',
'Liberación Articulo 91',
+502
View File
@@ -0,0 +1,502 @@
{
"info": {
"_postman_id": "5672f077-78c4-41d4-8877-6c8ccddbf3ef",
"name": "Servicios",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json",
"_exporter_id": "39860549"
},
"item": [
{
"name": "cuestionarios",
"item": [
{
"name": "cuestionario_alumno",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"year\":\"2024\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{api}}/cuestionario_alumno?year=2024",
"host": [
"{{api}}"
],
"path": [
"cuestionario_alumno"
],
"query": [
{
"key": "year",
"value": "2024"
}
]
}
},
"response": []
},
{
"name": "cuestionario_alumno",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"token\":\"asdfasdf\",\n \"idServicio\":3,\n \n \"p1\": \"Dependencia de la UNAM, Asesoría académica, Oportunidad de desarrollo de tesis\",\n\n \"p12_A_1\": \"Deficiente\",\n \"p12_A_2\": \"Deficiente\",\n \"p12_A_3\": \"Deficiente\",\n \"p12_A_4\": \"Deficiente\",\n \"p12_B_1\": \"Básico\",\n \"p12_B_2\": \"Básico\",\n \"p12_B_3\": \"Básico\",\n \"p12_B_4\": \"Básico\",\n \"p12_C_1\": \"Intermedio\",\n \"p12_C_2\": \"Intermedio\",\n \"p12_C_3\": \"Intermedio\",\n \"p12_C_4\": \"Intermedio\",\n \"p10_1\": \"si\",\n \"p10_2\": \"si\",\n \"p10_3\": \"si\",\n \"p11_1\": \"Nunca\",\n \"p11_2\": \"Rara vez\",\n \"p11_3\": \"Algunas veces\",\n \"p11_4\": \"Siempre\",\n \"p17_1\": \"si\",\n \"p17_2\": \"no\",\n \"p17_3\": \"si\",\n \"p3_1\": \"si\",\n \"p3_2\": \"si\",\n \"p3_3\": \"si\",\n \"p3_4\": \"si\",\n \"p12_D_1\": \"Destacado\",\n \"p12_D_2\": \"Destacado\",\n \"p12_D_3\": \"Destacado\",\n \"p12_D_4\": \"Destacado\",\n \"p12_D_5\": \"Destacado\",\n \"p2\": \"Deficiente\",\n \"p4\": \"No\",\n \"p5\": \"respuesta5\",\n \"p6\": \"Sí\",\n \"p7\": \"Sí\",\n \"p8\": \"respuesta8\",\n \"p9\": \"Sí\",\n \"p13\": \"Responsable directo del programa\",\n \"p14\": \"Se te otorgó de acuerdo a lo establecido\",\n \"p15\": \"Sí\",\n \"p16\": \"respuesta 16\",\n \"p18\": \"respuesta18\"\n\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": "{{api}}/cuestionario_alumno"
},
"response": []
}
]
},
{
"name": "usuarios",
"item": [
{
"name": "login",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n usuario:\"asdfasdf\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": "{{api}}/usuario/login"
},
"response": []
},
{
"name": "escolares",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/usuario/escolares"
},
"response": []
},
{
"name": "responsable",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/usuario/responsable"
},
"response": []
},
{
"name": "responsables",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/usuario/responsables"
},
"response": []
},
{
"name": "new pass alumno",
"request": {
"method": "PUT",
"header": [],
"url": "{{api}}/usuario/new_password_alumno"
},
"response": []
},
{
"name": "new pass respon",
"request": {
"method": "PUT",
"header": [],
"url": "{{api}}/usuario/new_password_responsable"
},
"response": []
},
{
"name": "responsable update",
"request": {
"method": "PUT",
"header": [],
"url": "{{api}}/usuario/responsable/update"
},
"response": []
}
]
},
{
"name": "status",
"item": [
{
"name": "status",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/status"
},
"response": []
}
]
},
{
"name": "servicio",
"item": [
{
"name": "status Copy",
"request": {
"method": "POST",
"header": [],
"url": "{{api}}/servicio/nuevo"
},
"response": []
},
{
"name": "status Copy 2",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/servicio/admin"
},
"response": []
},
{
"name": "status Copy 3",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/servicio/alumno"
},
"response": []
},
{
"name": "status Copy 4",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/servicio/gustavo_baz_prada"
},
"response": []
},
{
"name": "status Copy 5",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/servicio/reporte"
},
"response": []
},
{
"name": "status Copy 6",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/servicio/servicios_admin"
},
"response": []
},
{
"name": "status Copy 7",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/servicio/servicios_responsable"
},
"response": []
},
{
"name": "status Copy 8",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/servicio/cancelar"
},
"response": []
},
{
"name": "status Copy 9",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/servicio/carta_aceptacion"
},
"response": []
},
{
"name": "status Copy 10",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/servicio/carta_termino"
},
"response": []
},
{
"name": "status Copy 11",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/servicio/informe_global"
},
"response": []
},
{
"name": "status Copy 12",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/servicio/liberacion"
},
"response": []
},
{
"name": "status Copy 13",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/servicio/registro"
},
"response": []
},
{
"name": "status Copy 14",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/servicio/registro_validado"
},
"response": []
},
{
"name": "status Copy 15",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/servicio/rechazar_aceptacion"
},
"response": []
},
{
"name": "status Copy 16",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/servicio/rechazar_informe"
},
"response": []
},
{
"name": "status Copy 17",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/servicio/rechazar_termino"
},
"response": []
},
{
"name": "status Copy 18",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/servicio/update"
},
"response": []
}
]
},
{
"name": "Programa",
"item": [
{
"name": "status Copy 2",
"request": {
"method": "POST",
"header": [],
"url": "{{api}}/programa/carga_masiva"
},
"response": []
},
{
"name": "status Copy 3",
"request": {
"method": "POST",
"header": [],
"url": "{{api}}/programa/reasignar_programas"
},
"response": []
},
{
"name": "status Copy 4",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/programa/programas_admin"
},
"response": []
},
{
"name": "status Copy 5",
"request": {
"method": "POST",
"header": [],
"url": "{{api}}/programa/programas_responsable"
},
"response": []
}
]
},
{
"name": "cuestionario",
"item": [
{
"name": "cuestonario programa",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/cuestionario_programa"
},
"response": []
},
{
"name": "cuestonario programa Copy",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/cuestionario_programa"
},
"response": []
},
{
"name": "cuestonario alumno",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/cuestionario_alumno"
},
"response": []
},
{
"name": "cuestonario alumno",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/cuestionario_alumno"
},
"response": []
}
]
},
{
"name": "caso especial",
"item": [
{
"name": "cuestonario alumno Copy",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/caso_especial/nuevo"
},
"response": []
},
{
"name": "cuestonario alumno Copy 2",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/caso_especial"
},
"response": []
},
{
"name": "cuestonario alumno Copy 3",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/caso_especial/servicios_especiales"
},
"response": []
},
{
"name": "cuestonario alumno Copy 4",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/caso_especial/liberacion"
},
"response": []
},
{
"name": "cuestonario alumno Copy 5",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}/caso_especial/update"
},
"response": []
}
]
},
{
"name": "New Request",
"request": {
"method": "GET",
"header": [],
"url": "{{api}}"
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"packages": {},
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"packages": {},
"exec": [
""
]
}
}
],
"variable": [
{
"key": "api",
"value": "http://localhost:3072",
"type": "string"
},
{
"key": "api",
"value": "https://venus.acatlan.unam.mx/ss-pruebas",
"type": "string",
"disabled": true
}
]
}
+107
View File
@@ -0,0 +1,107 @@
CREATE DATABASE Universidad;
USE Universidad;
CREATE TABLE Alumnos ( cuenta INT PRIMARY KEY, nombre VARCHAR(255), carrera VARCHAR(255), creditos DECIMAL(5,2));
INSERT INTO Alumnos (cuenta, nombre, carrera, creditos) VALUES
(455229002, 'Sara Francisco Ortega Ramos', 'LIC. EN FILOSOFIA', 3.37),
(344254873, 'Ing. Liliana García', 'LIC. ENSEÑANZA DE ESPAÑOL(LENG. EXTRANJ)', 54.26),
(108304507, 'Modesto Samaniego', 'LIC. EN COMUNICACION', 45.52),
(103285757, 'Rosalia Gonzalo Granado', 'LIC. EN LENGUA Y LITERATURA HISPANICAS', 83.41),
(510877055, 'Guillermo Cazares Vásquez', 'LIC. EN LENGUA Y LITERATURA HISPANICAS', 84.5),
(220810204, 'Wendolin Madera', 'LIC. EN ARQUITECTURA', 64.16),
(662985844, 'César Mayorga Rico', 'LIC. EN LENGUA Y LITERATURA HISPANICAS', 49.36),
(320707048, 'Natalia Martha Patiño', 'LIC. EN ARQUITECTURA', 75.9),
(460281371, 'Micaela Araceli Amaya', 'LIC. EN SOCIOLOGIA', 82.13),
(558466371, 'Fidel Vela Valencia', 'LIC. EN DISEÑO GRAFICO', 46.29),
(730812014, 'Yeni Pedro Collado Barraza', 'LIC. EN ACTUARIA', 64.73),
(657270526, 'Miriam María Eugenia Ochoa', 'LIC. EN HISTORIA', 6.06),
(553042949, 'Patricia Cristal Feliciano', 'LIC. EN MATEMATICAS APLICADAS Y COMP.', 21.64),
(256120924, 'Olga Federico Abrego Espinoza', 'LIC. EN LENGUA Y LITERATURA HISPANICAS', 57.51),
(580095253, 'Jaqueline Candelaria', 'LIC. EN INGENIERIA CIVIL', 21.71),
(894433015, 'Agustín Galván Salgado', 'LIC. ENSEÑANZA DE ALEMÁN (LENG. EXTRANJS', 10.66),
(249880845, 'Lic. Felipe Madrigal', 'LIC. EN LENGUA Y LITERATURA HISPANICAS', 21.64),
(776013075, 'Dr. Jerónimo Arteaga', 'LIC. ENSEÑANZA DE ESPAÑOL(LENG. EXTRANJ)', 90.96),
(711114545, 'Hermelinda Rendón Esquivel', 'LIC. ENSEÑANZA DE ESPAÑOL(LENG. EXTRANJ)', 98.52),
(969046528, 'Norma Rubio', 'LIC. EN FILOSOFIA', 40.1),
(977597890, 'Perla Guzmán Mora', 'LIC. EN INGENIERIA CIVIL', 79.66),
(989320527, 'Soledad Abreu', 'LIC. EN DERECHO (SUA)', 0.46),
(557675592, 'Juan Carlos Tovar', 'LIC. EN DERECHO', 86.37),
(454578965, 'Reynaldo Elias Berríos', 'LIC. EN LENGUA Y LITERATURA HISPANICAS', 51.72),
(574884941, 'Clara Alberto Bahena', 'LIC. EN RELACIONES INTERNACIONALES (SUA)', 43.79),
(344273189, 'Noemí Abrego Beltrán', 'LIC. EN RELACIONES INTERNACIONALES (SUA)', 92.72),
(920455788, 'Ilse Mata', 'LIC. EN ACTUARIA', 85.39),
(843807025, 'Alfredo Homero Lomeli', 'LIC. EN ENSEÑANZA DE INGLES', 98.72),
(737482670, 'Sr(a). Natalia Ortega', 'LIC. EN PEDAGOGÍA', 27.62),
(947886427, 'Amalia Emiliano Sanabria González', 'LIC. EN RELACIONES INTERNACIONALES', 23.84),
(303428996, 'Camilo Fajardo Caldera', 'LIC. EN COMUNICACION', 28.69),
(504420847, 'Socorro Gonzalo Varela Escalante', 'LIC. ENSEÑANZA DE INGLÉS(LENG. EXTRANJE)', 76.77),
(916897575, 'Lic. Armando Vallejo', 'LIC. EN RELACIONES INTERNACIONALES (SUA)', 76.18),
(910548164, 'Ing. Dulce Serna', 'LIC. ENSEÑANZA DE ITALIANO(LENG. EXTRANJ', 99.85),
(287603576, 'Bernardo Juana Barrientos Anguiano', 'LIC. EN SOCIOLOGIA', 83.36),
(127855790, 'Lilia Wendolin Urbina Hernández', 'LIC. EN MATEMATICAS APLICADAS Y COMP.', 28.4),
(572039876, 'Soledad Benjamín Tello Aranda', 'LIC. EN DERECHO (SUA)', 6.27),
(177669679, 'María Luisa Rodarte Sotelo', 'LIC. ENSEÑANZA DE INGLÉS(LENG. EXTRANJE)', 17.71),
(750642431, 'Dr. Fabiola Montoya', 'LIC. ENSEÑANZA DE ALEMÁN (LENG. EXTRANJS', 87.34),
(181357215, 'Berta Bruno Cervantes', 'LIC. EN DISEÑO GRAFICO', 98.56),
(837171875, 'Sandra Miriam Arevalo', 'LIC. EN HISTORIA', 77.77),
(865516896, 'Federico Rafaél Ozuna', 'LIC. EN FILOSOFIA', 5.81),
(418259119, 'Ing. Alfredo Galván', 'LIC. ENSEÑANZA DE ITALIANO(LENG. EXTRANJ', 74.91),
(654945240, 'Alejandra Miguel Ángel Paz', 'LIC. EN DERECHO', 70.53),
(838906646, 'Juana Valentín', 'LIC. EN FILOSOFIA', 13.81),
(786618542, 'Vanesa Contreras', 'LIC. EN CIENCIAS POLITICAS Y ADMON PUB', 18.42),
(311809331, 'Cristobal Lucía Lozano Rico', 'LIC. EN MAT. APLICADAS Y COMPUTACION', 46.31),
(633338912, 'Zacarías Zúñiga Cervantes', 'LIC. ENSEÑANZA DE ALEMÁN (LENG. EXTRANJS', 16.59),
(430388364, 'Linda Gómez', 'LIC. ENSEÑANZA DE ITALIANO(LENG. EXTRANJ', 30.53),
(494179153, 'Emiliano Robledo Montes', 'LIC. EN COMUNICACION', 90.31),
(761549514, 'Julia Rosa Corrales Luevano', 'LIC. ENSEÑANZA DE ESPAÑOL(LENG. EXTRANJ)', 68.57),
(917797548, 'Elvia Camarillo', 'LIC. EN DISEÑO GRAFICO', 93.9),
(656519098, 'Asunción Valles Arguello', 'LIC. EN DERECHO (SUA)', 49.11),
(959317624, 'Abraham Merino Collado', 'LIC. EN LENGUA Y LITERATURA HISPANICAS', 74.86),
(529088942, 'Mtro. José Emilio Carrero', 'LIC. EN DERECHO', 25.26),
(410136542, 'Lic. Ivonne Crespo', 'LIC. EN CIENCIAS POLITICAS Y ADMON PUB', 41.01),
(955532842, 'Hermelinda Violeta Vela', 'LIC. ENSEÑANZA DE ITALIANO(LENG. EXTRANJ', 23.99),
(944109052, 'Leonardo Mónica Arenas Barreto', 'LIC. EN CIENCIAS POLITICAS Y ADMON PUB', 65.66),
(736137931, 'Mtro. Vanesa Santiago', 'LIC. EN MAT. APLICADAS Y COMPUTACION', 60.6),
(548504744, 'René Gutiérrez Ozuna', 'LIC. EN ECONOMIA', 51.1),
(230591766, 'Esparta Zamudio Rendón', 'LIC. ENSEÑANZA DE ESPAÑOL(LENG. EXTRANJ)', 96.7),
(365584469, 'Lic. Jacinto Baeza', 'LIC. EN ENSEÑANZA DE INGLES', 16.6),
(366378810, 'Benito Garica Gómez', 'LIC. EN DISEÑO GRAFICO', 50.21),
(130793203, 'Mercedes Dalia Melgar', 'LIC. EN DISEÑO GRAFICO', 79.79),
(118327168, 'Aurelio Juana Chávez', 'LIC. EN PEDAGOGÍA', 65.11),
(541469134, 'René Estévez Alvarez', 'LIC. EN ENSEÑANZA DE INGLES', 83.62),
(146702834, 'Verónica Hugo Montañez Montero', 'LIC. EN ACTUARIA', 82.31),
(391227832, 'Federico Escobar Gollum', 'LIC. EN MATEMATICAS APLICADAS Y COMP.', 53.46),
(620658001, 'Ing. Bernabé Flores', 'LIC. EN ENSEÑANZA DE INGLES', 77.52),
(434742427, 'Esmeralda Yeni Téllez Guerrero', 'LIC. ENSEÑANZA DE ALEMÁN (LENG. EXTRANJS', 92.49),
(789523713, 'Margarita Bahena Rodríquez', 'LIC. EN MAT. APLICADAS Y COMPUTACION', 32.86),
(388536523, 'Hilda Aparicio Ulloa', 'LIC. EN RELACIONES INTERNACIONALES (SUA)', 29.32),
(533652320, 'Lic. Luis Miguel Concepción', 'LIC. EN RELACIONES INTERNACIONALES (SUA)', 57.32),
(766082299, 'Tomás Córdova', 'LIC. ENSEÑANZA DE ALEMÁN (LENG. EXTRANJS', 73.03),
(386050318, 'Noelia Villarreal Colón', 'LIC. EN RELACIONES INTERNACIONALES (SUA)', 17.6),
(746187129, 'Sr(a). Jos Nava', 'LIC. EN ARQUITECTURA', 95.45),
(485991016, 'Lucía Aurora Casárez', 'LIC. EN ACTUARIA', 42.66),
(563067802, 'David Jorge Pizarro Camarillo', 'LIC. EN DERECHO (SUA)', 62.65),
(736767614, 'Ing. Adán Serna', 'LIC. EN HISTORIA', 88.74),
(809970519, 'Rosalia Amelia Zamora Molina', 'LIC. EN RELACIONES INTERNACIONALES', 74.47),
(895517249, 'Gloria Genaro Bustos', 'LIC. ENSEÑANZA DE INGLÉS(LENG. EXTRANJE)', 68.23),
(747147954, 'Nadia Becerra', 'LIC. EN ECONOMIA', 2.22),
(354535405, 'Roberto Zamora', 'LIC. EN COMUNICACION', 87.97),
(577656886, 'Hernán Robledo Guevara', 'LIC. ENSEÑANZA DE ESPAÑOL(LENG. EXTRANJ)', 66.64),
(187735537, 'Camila Gaytán Guerrero', 'LIC. EN DERECHO (SUA)', 6.46),
(399199599, 'José Luis Humberto Villalpando', 'LIC. EN DERECHO (SUA)', 6.83),
(143603799, 'Anabel Rodríquez', 'LIC. EN RELACIONES INTERNACIONALES', 34.91),
(966725974, 'Laura Gloria Maya', 'LIC. EN MATEMATICAS APLICADAS Y COMP.', 51.86),
(612650412, 'Elvira Villaseñor', 'LIC. EN MATEMATICAS APLICADAS Y COMP.', 51.44),
(931796380, 'Clemente Nayeli Robledo', 'LIC. EN CIENCIAS POLITICAS Y ADMON.PUBL.', 29.24),
(414281020, 'Arcelia Delgadillo', 'LIC. ENSEÑANZA DE INGLÉS(LENG. EXTRANJE)', 10.09),
(142787880, 'Inés Julio César Tijerina Roybal', 'LIC. EN ENSEÑANZA DE INGLES', 53.02),
(439856515, 'Bruno Guardado', 'LIC. EN PERIODISMO Y COMUNICACION COL.', 4.94),
(378161746, 'Lic. Porfirio García', 'LIC. EN LENGUA Y LITERATURA HISPANICAS', 50.44),
(216618195, 'Nayeli Raquel Serrato', 'LIC. ENSEÑANZA DE ITALIANO(LENG. EXTRANJ', 56.96),
(826483124, 'Dr. Gabino Carrera', 'LIC. EN SOCIOLOGIA', 74.9),
(936737436, 'Yeni Liliana Pedroza Girón', 'LIC. EN CIENCIAS POLITICAS Y ADMON.PUBL.', 48.61),
(350401488, 'Dalia Julia Trujillo', 'LIC. EN CIENCIAS POLITICAS Y ADMON PUB', 80.19),
(443993884, 'Abigail Caridad Cervántez Rojas', 'LIC. EN DISEÑO GRAFICO', 86.89),
(920680444, 'Barbara David Montoya', 'LIC. EN PERIODISMO Y COMUNICACION COL.', 81.56);
+61 -51
View File
@@ -24,6 +24,7 @@
"mariadb": "^2.5.1", "mariadb": "^2.5.1",
"moment": "^2.29.1", "moment": "^2.29.1",
"multer": "^1.4.2", "multer": "^1.4.2",
"nodemailer": "^6.10.1",
"sequelize": "^6.3.5", "sequelize": "^6.3.5",
"validator": "^13.1.17" "validator": "^13.1.17"
}, },
@@ -90,9 +91,9 @@
"integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==" "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA=="
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "14.18.4", "version": "14.18.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.4.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.7.tgz",
"integrity": "sha512-swe3lD4izOJWHuxvsZdDFRq6S9i6koJsXOnQKYekhSO5JTizMVirUFgY/bUsaOJQj8oSD4oxmRYPBM/0b6jpdw==" "integrity": "sha512-UpLEO1iBG7esNPusSAjoZhWFK5Mfd8QfwWhHRrg5io13POn/stsBgTCba9suQaFflNA4tc0+6AFM3R6BZNng6A=="
}, },
"node_modules/abbrev": { "node_modules/abbrev": {
"version": "1.1.1", "version": "1.1.1",
@@ -1008,9 +1009,9 @@
} }
}, },
"node_modules/follow-redirects": { "node_modules/follow-redirects": {
"version": "1.14.6", "version": "1.14.7",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
"integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==", "integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==",
"funding": [ "funding": [
{ {
"type": "individual", "type": "individual",
@@ -1205,11 +1206,11 @@
} }
}, },
"node_modules/google-p12-pem": { "node_modules/google-p12-pem": {
"version": "3.1.2", "version": "3.1.3",
"resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-3.1.2.tgz", "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-3.1.3.tgz",
"integrity": "sha512-tjf3IQIt7tWCDsa0ofDQ1qqSCNzahXDxdAGJDbruWqu3eCg5CKLYKN+hi0s6lfvzYZ1GDVr+oDF9OOWlDSdf0A==", "integrity": "sha512-MC0jISvzymxePDVembypNefkAQp+DRP7dBE+zNUPaIjEspIlYg0++OrsNr248V9tPbz6iqtZ7rX1hxWA5B8qBQ==",
"dependencies": { "dependencies": {
"node-forge": "^0.10.0" "node-forge": "^1.0.0"
}, },
"bin": { "bin": {
"gp12-pem": "build/src/bin/gp12-pem.js" "gp12-pem": "build/src/bin/gp12-pem.js"
@@ -1269,9 +1270,9 @@
} }
}, },
"node_modules/graceful-fs": { "node_modules/graceful-fs": {
"version": "4.2.8", "version": "4.2.9",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz",
"integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==",
"dev": true "dev": true
}, },
"node_modules/gtoken": { "node_modules/gtoken": {
@@ -1967,28 +1968,37 @@
"integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==" "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A=="
}, },
"node_modules/node-fetch": { "node_modules/node-fetch": {
"version": "2.6.6", "version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==", "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
"dependencies": { "dependencies": {
"whatwg-url": "^5.0.0" "whatwg-url": "^5.0.0"
}, },
"engines": { "engines": {
"node": "4.x || >=6.0.0" "node": "4.x || >=6.0.0"
},
"peerDependencies": {
"encoding": "^0.1.0"
},
"peerDependenciesMeta": {
"encoding": {
"optional": true
}
} }
}, },
"node_modules/node-forge": { "node_modules/node-forge": {
"version": "0.10.0", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.2.1.tgz",
"integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", "integrity": "sha512-Fcvtbb+zBcZXbTTVwqGA5W+MKBj56UjVRevvchv5XrcyXbmNdesfZL37nlcWOfpgHhgmxApw3tQbTr4CqNmX4w==",
"engines": { "engines": {
"node": ">= 6.0.0" "node": ">= 6.13.0"
} }
}, },
"node_modules/nodemailer": { "node_modules/nodemailer": {
"version": "6.7.2", "version": "6.10.1",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.7.2.tgz", "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.10.1.tgz",
"integrity": "sha512-Dz7zVwlef4k5R71fdmxwR8Q39fiboGbu3xgswkzGwczUfjp873rVxt1O46+Fh0j1ORnAC6L9+heI8uUpO6DT7Q==", "integrity": "sha512-Z+iLaBGVaSjbIzQ4pX6XV41HrooLsQ10ZWPUehGmuantvzWoDVBnmsdUcOIDM1t+yPor5pDhVlDESgOMEGxhHA==",
"license": "MIT-0",
"engines": { "engines": {
"node": ">=6.0.0" "node": ">=6.0.0"
} }
@@ -2471,9 +2481,9 @@
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
}, },
"node_modules/sequelize": { "node_modules/sequelize": {
"version": "6.12.4", "version": "6.13.0",
"resolved": "https://registry.npmjs.org/sequelize/-/sequelize-6.12.4.tgz", "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-6.13.0.tgz",
"integrity": "sha512-P2E8TzlV3VwdvPqTS58ctIpcAOytXdaylUUfxxnALjtMmF6I+kfNtrqTP7WQFaenOboAtXPCJReZ9MPy+Zy/Ig==", "integrity": "sha512-p0dXXGZSc0Ng7CdGwlKN4P6DTRD/w9Ar2CnmHamNVDnqEWh6pMVOp3xrlG5+IWhbwrqL3SjIYEYt3Xog1vXRDw==",
"funding": [ "funding": [
{ {
"type": "opencollective", "type": "opencollective",
@@ -3051,9 +3061,9 @@
"integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==" "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA=="
}, },
"@types/node": { "@types/node": {
"version": "14.18.4", "version": "14.18.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.4.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.7.tgz",
"integrity": "sha512-swe3lD4izOJWHuxvsZdDFRq6S9i6koJsXOnQKYekhSO5JTizMVirUFgY/bUsaOJQj8oSD4oxmRYPBM/0b6jpdw==" "integrity": "sha512-UpLEO1iBG7esNPusSAjoZhWFK5Mfd8QfwWhHRrg5io13POn/stsBgTCba9suQaFflNA4tc0+6AFM3R6BZNng6A=="
}, },
"abbrev": { "abbrev": {
"version": "1.1.1", "version": "1.1.1",
@@ -3771,9 +3781,9 @@
} }
}, },
"follow-redirects": { "follow-redirects": {
"version": "1.14.6", "version": "1.14.7",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
"integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==" "integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ=="
}, },
"forwarded": { "forwarded": {
"version": "0.2.0", "version": "0.2.0",
@@ -3908,11 +3918,11 @@
} }
}, },
"google-p12-pem": { "google-p12-pem": {
"version": "3.1.2", "version": "3.1.3",
"resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-3.1.2.tgz", "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-3.1.3.tgz",
"integrity": "sha512-tjf3IQIt7tWCDsa0ofDQ1qqSCNzahXDxdAGJDbruWqu3eCg5CKLYKN+hi0s6lfvzYZ1GDVr+oDF9OOWlDSdf0A==", "integrity": "sha512-MC0jISvzymxePDVembypNefkAQp+DRP7dBE+zNUPaIjEspIlYg0++OrsNr248V9tPbz6iqtZ7rX1hxWA5B8qBQ==",
"requires": { "requires": {
"node-forge": "^0.10.0" "node-forge": "^1.0.0"
} }
}, },
"googleapis": { "googleapis": {
@@ -3957,9 +3967,9 @@
} }
}, },
"graceful-fs": { "graceful-fs": {
"version": "4.2.8", "version": "4.2.9",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz",
"integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==",
"dev": true "dev": true
}, },
"gtoken": { "gtoken": {
@@ -4504,22 +4514,22 @@
"integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==" "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A=="
}, },
"node-fetch": { "node-fetch": {
"version": "2.6.6", "version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==", "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
"requires": { "requires": {
"whatwg-url": "^5.0.0" "whatwg-url": "^5.0.0"
} }
}, },
"node-forge": { "node-forge": {
"version": "0.10.0", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.2.1.tgz",
"integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" "integrity": "sha512-Fcvtbb+zBcZXbTTVwqGA5W+MKBj56UjVRevvchv5XrcyXbmNdesfZL37nlcWOfpgHhgmxApw3tQbTr4CqNmX4w=="
}, },
"nodemailer": { "nodemailer": {
"version": "6.7.2", "version": "6.10.1",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.7.2.tgz", "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.10.1.tgz",
"integrity": "sha512-Dz7zVwlef4k5R71fdmxwR8Q39fiboGbu3xgswkzGwczUfjp873rVxt1O46+Fh0j1ORnAC6L9+heI8uUpO6DT7Q==" "integrity": "sha512-Z+iLaBGVaSjbIzQ4pX6XV41HrooLsQ10ZWPUehGmuantvzWoDVBnmsdUcOIDM1t+yPor5pDhVlDESgOMEGxhHA=="
}, },
"nodemon": { "nodemon": {
"version": "2.0.15", "version": "2.0.15",
@@ -4888,9 +4898,9 @@
} }
}, },
"sequelize": { "sequelize": {
"version": "6.12.4", "version": "6.13.0",
"resolved": "https://registry.npmjs.org/sequelize/-/sequelize-6.12.4.tgz", "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-6.13.0.tgz",
"integrity": "sha512-P2E8TzlV3VwdvPqTS58ctIpcAOytXdaylUUfxxnALjtMmF6I+kfNtrqTP7WQFaenOboAtXPCJReZ9MPy+Zy/Ig==", "integrity": "sha512-p0dXXGZSc0Ng7CdGwlKN4P6DTRD/w9Ar2CnmHamNVDnqEWh6pMVOp3xrlG5+IWhbwrqL3SjIYEYt3Xog1vXRDw==",
"requires": { "requires": {
"@types/debug": "^4.1.7", "@types/debug": "^4.1.7",
"debug": "^4.3.3", "debug": "^4.3.3",
+1
View File
@@ -32,6 +32,7 @@
"mariadb": "^2.5.1", "mariadb": "^2.5.1",
"moment": "^2.29.1", "moment": "^2.29.1",
"multer": "^1.4.2", "multer": "^1.4.2",
"nodemailer": "^6.10.1",
"sequelize": "^6.3.5", "sequelize": "^6.3.5",
"validator": "^13.1.17" "validator": "^13.1.17"
}, },
+1 -1
View File
@@ -17,7 +17,7 @@ app.use(bodyParser.json());
app.use(express.static('csv')); app.use(express.static('csv'));
app.get('/', (req, res) => res.send('API IRIS')); app.get('/', (req, res) => res.send('API IRIS updated 30 jan'));
app.use(require('./routes/index')); app.use(require('./routes/index'));
+2 -2
View File
@@ -10,9 +10,9 @@ const sequelize = new Sequelize(
dialect: process.env.TYPEDB, dialect: process.env.TYPEDB,
logging: false, logging: false,
dialectOptions: { dialectOptions: {
useUTC: false, timezone: "America/Mexico_City", // También en dialectOptions
}, },
timezone: '-05:00', timezone: '-06:00',
} }
); );
+20 -5
View File
@@ -15,16 +15,31 @@ const admin = async (body) => {
return CasoEspecial.findOne({ return CasoEspecial.findOne({
where: { idCasoEspecial }, where: { idCasoEspecial },
include: [ include: [
{ model: Usuario, include: [{ model: TipoUsuario }] }, {
model: Usuario,
include: [{ model: TipoUsuario }],
attributes: ['idUsuario', 'usuario', 'nombre'],
},
{ model: Carrera }, { model: Carrera },
{ model: Status }, { model: Status },
], ],
attributes: [
'idCasoEspecial',
'creditos',
'correo',
'telefono',
'institucion',
'dependencia',
'motivo',
'direccion',
'fechaInicio',
'fechaFin',
'fechaNacimiento',
'archivoZip',
'createdAt',
],
}).then((res) => { }).then((res) => {
if (!res) throw new Error('No existe este Caso Especial.'); if (!res) throw new Error('No existe este Caso Especial.');
delete res.dataValues.Usuario.dataValues.password;
delete res.dataValues.idUsuario;
delete res.dataValues.idCarrera;
delete res.dataValues.idStatus;
return res; return res;
}); });
}; };
+1 -1
View File
@@ -49,7 +49,7 @@ const nuevo = async (body, file) => {
let carpeta = ''; let carpeta = '';
return Usuario.findOne({ return Usuario.findOne({
where: { idUsuario }, where: { idUsuario },
}) })
.then((res) => { .then((res) => {
if (!res) throw new Error('Este alumno no existe en la db.'); if (!res) throw new Error('Este alumno no existe en la db.');
@@ -35,19 +35,16 @@ const serviciosEspeciales = async (body) => {
{ nombre: { [Op.like]: `%${nombre}%` } }, { nombre: { [Op.like]: `%${nombre}%` } },
], ],
}, },
attributes: ['idUsuario', 'usuario', 'nombre'],
}, },
{ model: Carrera }, { model: Carrera },
{ model: Status, where }, { model: Status, where },
], ],
attributes: ['idCasoEspecial', 'fechaInicio', 'fechaFin', 'createdAt'],
order: [['updatedAt', 'DESC']], order: [['updatedAt', 'DESC']],
limit: 25, limit: 25,
offset: 25 * (pagina - 1), offset: 25 * (pagina - 1),
}).then((res) => { }).then((res) => ({ count: res.count, serviciosEspeciales: res.rows }));
for (let i = 0; i < res.rows.length; i++) {
// delete res.rows[i].dataValues.idUsuario
}
return { count: res.count, serviciosEspeciales: res.rows };
});
}; };
module.exports = serviciosEspeciales; module.exports = serviciosEspeciales;
+67 -1
View File
@@ -10,7 +10,9 @@ const Programa = require(`${dbPath}/Programa`);
const Servicio = require(`${dbPath}/Servicio`); const Servicio = require(`${dbPath}/Servicio`);
const Usuario = require(`${dbPath}/Usuario`); const Usuario = require(`${dbPath}/Usuario`);
const get = async (body) => { const CuestionarioAlumno2 = require(`${dbPath}/CuestionarioAlumno2`);
const getOld = async (body) => {
const year = validarNumero(body.year, 'año', true, 4); const year = validarNumero(body.year, 'año', true, 4);
const path = `server/uploads/${year}_cuestionario_alumno.csv`; const path = `server/uploads/${year}_cuestionario_alumno.csv`;
const data = []; const data = [];
@@ -79,4 +81,68 @@ const get = async (body) => {
.then((res) => path); .then((res) => path);
}; };
const get = async (body) => {
console.log(body);
const version = body.version
const year = validarNumero(body.year, 'año', true, 4);
const path = `server/uploads/${year}_cuestionario_alumno.csv`;
const data = [];
console.log(year);
let temp
if(version == 'v1'){
temp = CuestionarioAlumno.findAll({
where: {
idCuestionarioAlumno: {
[Op.not]: null,
},
},
})
}
if(version == 'v2'){
temp = CuestionarioAlumno2.findAll({
where: {
idCuestionarioAlumno2: {
[Op.not]: null,
},
},
})
}
return temp
.then(async (res) => {
console.log('segunda parte', res);
for (let i = 0; i < res.length; i++) {
data.push(res[i].get({ plain: true }));
}
// Alternativa manual si necesitas campos específicos
/* for (let i = 0; i < res.length; i++) {
const row = res[i].get({ plain: true });
data.push({
idCuestionarioAlumno2: row.idCuestionarioAlumno2,
p1: row.p1,
p2: row.p2,
p3: row.p3,
p4: row.p4,
p5: row.p5,
// Agrega los demás campos según sea necesario
});
} */
await helper.eliminarArchivo(path).catch((err) => {
console.log(err);
});
return helper.crearArchivo(path, convertArrayToCSV(data));
})
.then((res) => path);
};
module.exports = get; module.exports = get;
+122 -1
View File
@@ -3,7 +3,11 @@ const dbPath = '../../db/tablas';
const CuestionarioAlumno = require(`${dbPath}/CuestionarioAlumno`); const CuestionarioAlumno = require(`${dbPath}/CuestionarioAlumno`);
const Servicio = require(`${dbPath}/Servicio`); const Servicio = require(`${dbPath}/Servicio`);
const nuevo = async (body) => {
const CuestionarioAlumno2 = require(`${dbPath}/CuestionarioAlumno2`);
const nuevoOld = async (body) => {
const idServicio = validar.validarNumeroEntero( const idServicio = validar.validarNumeroEntero(
body.idServicio, body.idServicio,
'id servicio' 'id servicio'
@@ -161,4 +165,121 @@ const nuevo = async (body) => {
})); }));
}; };
const nuevo = async (body) => {
// console.log(body);
let idServicio = body.idServicio;
/*
const idServicio = validar.validarNumeroEntero(
body.idServicio,
'id servicio'
); */
body = validar.validarCuestionarioAlumno2(body);
// pasar preguntas de array a string
return Servicio.findOne({ where: { idServicio } })
.then(async (res) => {
if (!res) throw new Error('No existe este Servicio Social.');
if (res.idCuestionarioAlumno2)
throw new Error(
'Este Servicio Social ya cuenta con cuestionario de alumno'
);
console.log('el servicio social si existe');
// console.log(res);
/**
* existe el servicio social?
* tiene cuestionario alumno en la tabla cuestionario? select * from cuestionario where idServicio = 1
* si no existe, entonces se puede crear el cuestionario
* creamos el cuestionario y guardamos las respuestas
*/
const messageByStatus = {
1: 'Aun no se puede contestar el cuestionario este Servicio Social.',
2: 'Aun no se puede contestar el cuestionario este Servicio Social.',
3: 'Aun no se puede contestar el cuestionario este Servicio Social.',
5: 'Este Servicio Social ya paso la fase de contestar el cuestionario.',
6: 'Este Servicio Social ya paso la fase de contestar el cuestionario.',
7: 'Este Servicio Social se encuentra rechazado. No se puede avanzar hasta que se corrija lo necesario.',
8: 'Este Servicio Social se encuentra rechazado. No se puede avanzar hasta que se corrija lo necesario.',
9: 'Este Servicio Social se encuentra rechazado. No se puede avanzar hasta que se corrija lo necesario.',
10: 'Este Servicio Social fue cancelado.',
};
// if (res.idStatus === 4) return CuestionarioAlumno2.create({ ...body });
console.log('antes de create ques2');
// if (res.idStatus) return CuestionarioAlumno2.create({ ...body });
// si idStatus está en el objeto, arrojamos el mensaje
if (messageByStatus.hasOwnProperty(res.idStatus))
throw new Error(messageByStatus[res.idStatus]);
// throw new Error('Id status no valido.'); // si no coincide con nada, error por defecto
// Cuestionario.findOne({});
/* let dataCuestionario = await Cuestionario.findOne({
where: { idServicio, dirigidoA: 'estudiantes' },
});
console.log('data cuestionario', dataCuestionario);
if (dataCuestionario) {
throw new Error('Ya existe un cuestionario para este servicio social');
} */
/* let cuestionarioRegistro = await Cuestionario.create({
idServicio,
// idCuestionarioAlumno: respuestasRegistradas.idCuestionarioAlumno,
version: '2',
dirigidoA: 'estudiantes',
titulo: 'Cuestionario de Alumn v2',
desc: 'Cuestionario de Alumno v2',
createdAt: new Date(),
}); */
console.log("datos a registrar en la tabla cuestionarioAlumno2", { ...body} );
let respuestasRegistradas = await CuestionarioAlumno2.create({ ...body });
console.log('despues de registrar cuestionario', respuestasRegistradas);
console.log('agregar el id a la tabla servicio, esta validado en el front');
let resX = await Servicio.update(
{ idCuestionarioAlumno2: respuestasRegistradas.idCuestionarioAlumno2},
{ where: { idServicio } }
)
console.log('despues de registrar el id en la tabla servicio', resX);
return respuestasRegistradas;
})
.then((res) => validar.validarPreTermino(idServicio))
.then((res) => ({
message: `Se guardaron tus respuestas correctamente. ${res}`,
}));
};
module.exports = nuevo; module.exports = nuevo;
+81 -2
View File
@@ -6,12 +6,17 @@ const helper = require(`${helperPath}/helper`);
const { validarNumero } = require(`${helperPath}/validar`); const { validarNumero } = require(`${helperPath}/validar`);
const dbPath = '../../db/tablas'; const dbPath = '../../db/tablas';
const Carrera = require(`${dbPath}/Carrera`); const Carrera = require(`${dbPath}/Carrera`);
const CuestionarioPrograma = require(`${dbPath}/CuestionarioPrograma`);
const Servicio = require(`${dbPath}/Servicio`); const Servicio = require(`${dbPath}/Servicio`);
const Programa = require(`${dbPath}/Programa`); const Programa = require(`${dbPath}/Programa`);
const Usuario = require(`${dbPath}/Usuario`); const Usuario = require(`${dbPath}/Usuario`);
const get = async (body) => {
const CuestionarioPrograma2 = require(`${dbPath}/CuestionarioPrograma2`);
const CuestionarioPrograma = require(`${dbPath}/CuestionarioPrograma`);
const getOld = async (body) => {
const year = validarNumero(body.year, 'año', true, 4); const year = validarNumero(body.year, 'año', true, 4);
const path = `server/uploads/${year}_cuestionario_programa.csv`; const path = `server/uploads/${year}_cuestionario_programa.csv`;
const data = []; const data = [];
@@ -56,4 +61,78 @@ const get = async (body) => {
.then((res) => path); .then((res) => path);
}; };
const get = async (body) => {
const version = body.version
const year = validarNumero(body.year, 'año', true, 4);
const path = `server/uploads/${year}_cuestionario_programa.csv`;
const data = [];
let temp
if(version == 'v1'){
temp = CuestionarioPrograma.findAll({
where: {
idCuestionarioPrograma: {
[Op.not]: null,
},
},
})
}
if(version == 'v2'){
temp = CuestionarioPrograma2.findAll({
where: {
idCuestionarioPrograma2: {
[Op.not]: null,
},
},
})
}
return temp
.then(async (res) => {
console.log("segunda parte", res);
for (let i = 0; i < res.length; i++) {
data.push(res[i].get({ plain: true }));
}
// Alternativa manual si necesitas campos específicos
/* for (let i = 0; i < res.length; i++) {
const row = res[i].get({ plain: true });
data.push({
idCuestionarioPrograma2: row.idCuestionarioPrograma2,
p1: row.p1,
p2: row.p2,
p3: row.p3,
p4: row.p4,
p5: row.p5,
// Agrega los demás campos según sea necesario
});
} */
await helper.eliminarArchivo(path).catch((err) => {
console.log(err);
});
return helper.crearArchivo(path, convertArrayToCSV(data));
})
.then((res) => path);
}
module.exports = get; module.exports = get;
+130 -1
View File
@@ -3,7 +3,12 @@ const dbPath = '../../db/tablas';
const CuestionarioPrograma = require(`${dbPath}/CuestionarioPrograma`); const CuestionarioPrograma = require(`${dbPath}/CuestionarioPrograma`);
const Servicio = require(`${dbPath}/Servicio`); const Servicio = require(`${dbPath}/Servicio`);
const nuevo = async (body) => {
const CuestionarioPrograma2 = require(`${dbPath}/CuestionarioPrograma2`);
const nuevoOld = async (body) => {
const idServicio = validar.validarNumeroEntero( const idServicio = validar.validarNumeroEntero(
body.idServicio, body.idServicio,
'id servicio' 'id servicio'
@@ -76,4 +81,128 @@ const nuevo = async (body) => {
})); }));
}; };
const nuevo = async (body) => {
// console.log(body);
let idServicio = body.idServicio;
body = validar.validarCuestionarioPrograma2(body);
/*
const idServicio = validar.validarNumeroEntero(
body.idServicio,
'id servicio'
); */
// pasar preguntas de array a string
return Servicio.findOne({ where: { idServicio } })
.then(async (res) => {
if (!res) throw new Error('No existe este Servicio Social.');
if (res.idCuestionarioPrograma2)
throw new Error(
'Este Servicio Social ya cuenta con cuestionario de programa'
);
console.log('el servicio social si existe', res);
// console.log(res);
/**
* existe el servicio social?
* tiene cuestionario alumno en la tabla cuestionario? select * from cuestionario where idServicio = 1
* si no existe, entonces se puede crear el cuestionario
* creamos el cuestionario y guardamos las respuestas
*/
const messageByStatus = {
1: 'Aun no se puede contestar el cuestionario este Servicio Social.',
2: 'Aun no se puede contestar el cuestionario este Servicio Social.',
3: 'Aun no se puede contestar el cuestionario este Servicio Social.',
5: 'Este Servicio Social ya paso la fase de contestar el cuestionario.',
6: 'Este Servicio Social ya paso la fase de contestar el cuestionario.',
7: 'Este Servicio Social se encuentra rechazado. No se puede avanzar hasta que se corrija lo necesario.',
8: 'Este Servicio Social se encuentra rechazado. No se puede avanzar hasta que se corrija lo necesario.',
9: 'Este Servicio Social se encuentra rechazado. No se puede avanzar hasta que se corrija lo necesario.',
10: 'Este Servicio Social fue cancelado.',
};
// if (res.idStatus === 4) return CuestionarioPrograma2.create({ ...body });
console.log('antes de create ques2');
// if (res.idStatus) return CuestionarioPrograma2.create({ ...body });
// si idStatus está en el objeto, arrojamos el mensaje
if (messageByStatus.hasOwnProperty(res.idStatus))
throw new Error(messageByStatus[res.idStatus]);
// throw new Error('Id status no valido.'); // si no coincide con nada, error por defecto
/*
let dataCuestionario = await Cuestionario.findOne({
where: { idServicio, dirigidoA: 'programas' },
});
console.log('data cuestionario', dataCuestionario);
if (dataCuestionario) {
throw new Error('Ya existe un cuestionario para este servicio social');
}
let cuestionarioRegistro = await Cuestionario.create({
idServicio,
//idCuestionarioPrograma: respuestasRegistradas.idCuestionarioPrograma,
version: '2',
dirigidoA: 'programas',
titulo: 'Cuestionario de programa v2',
desc: 'Cuestionario de programa v2',
createdAt: new Date(),
});
console.log('cuestionario registrado', cuestionarioRegistro);
*/
// falta verificar que tenga solo un cuestionario
let respuestasRegistradas = await CuestionarioPrograma2.create({
...body,
});
console.log('despues de registrar cuestionario', respuestasRegistradas);
// si el cuestionario ya existe solo hay que actualizar el id de cuestionarioprograma o alumno
console.log("registrar id en servicio en cuestionario 2");
let x = await Servicio.update(
{ idCuestionarioPrograma2: respuestasRegistradas.idCuestionarioPrograma2 },
{ where: { idServicio } }
)
console.log(x);
return respuestasRegistradas;
})
.then((res) => validar.validarPreTermino(idServicio))
.then((res) => ({
message: `Se guardaron tus respuestas correctamente. ${res}`,
}));
};
module.exports = nuevo; module.exports = nuevo;
+44 -9
View File
@@ -13,20 +13,55 @@ const admin = async (body) => {
return Servicio.findOne({ return Servicio.findOne({
where: { idServicio }, where: { idServicio },
include: [ include: [
{ model: Usuario, include: [{ model: TipoUsuario }] }, {
model: Usuario,
include: [{ model: TipoUsuario }],
attributes: ['idUsuario', 'usuario', 'nombre'],
},
{ model: Carrera }, { model: Carrera },
{ model: Status }, { model: Status },
{ model: Programa, include: [{ model: Usuario }] }, {
model: Programa,
include: [
{
model: Usuario,
attributes: ['idUsuario', 'usuario', 'nombre'],
},
],
attributes: [
'idPrograma',
'institucion',
'dependencia',
'programa',
'clavePrograma',
'acatlan',
],
},
],
attributes: [
'idServicio',
'creditos',
'correo',
'telefono',
'direccion',
'fechaInicio',
'fechaFin',
'fechaLiberacion',
'fechaNacimiento',
'cartaAceptacion',
'cartaTermino',
'informeGlobal',
'programaInterno',
'profesor',
'vistoBuenoAcatlan',
'createdAt',
'idCuestionarioAlumno',
'idCuestionarioAlumno2',
'idCuestionarioPrograma',
'idCuestionarioPrograma2'
], ],
}).then((res) => { }).then((res) => {
if (!res) throw new Error('No existe este servicio social.'); if (!res) throw new Error('No existe este servicio social.');
delete res.dataValues.Usuario.dataValues.password;
delete res.dataValues.Programa.dataValues.idUsuario;
delete res.dataValues.Programa.dataValues.Usuario.dataValues.password;
delete res.dataValues.idUsuario;
delete res.dataValues.idCarrera;
delete res.dataValues.idStatus;
delete res.dataValues.idPrograma;
return res; return res;
}); });
}; };
+31 -12
View File
@@ -17,22 +17,41 @@ const alumno = async (body) => {
throw new Error('No es un usuario de tipo alumno.'); throw new Error('No es un usuario de tipo alumno.');
return Servicio.findOne({ return Servicio.findOne({
where: { idUsuario, idStatus: { [Op.not]: 10 } }, where: { idUsuario, idStatus: { [Op.not]: 10 } },
include: [{ model: Carrera }, { model: Status }, { model: Programa }], include: [
{ model: Carrera },
{ model: Status },
{
model: Programa,
attributes: [
'idPrograma',
'institucion',
'dependencia',
'programa',
'clavePrograma',
],
},
],
attributes: [
'idServicio',
'creditos',
'correo',
'telefono',
'direccion',
'fechaInicio',
'fechaFin',
'fechaLiberacion',
'fechaNacimiento',
'informeGlobal',
'programaInterno',
'profesor',
'createdAt',
'idCuestionarioAlumno',
'idCuestionarioAlumno2'
],
}); });
}) })
.then((res) => { .then((res) => {
if (!res) throw new Error('No existe este servicio social.'); if (!res) throw new Error('No existe este servicio social.');
delete res.dataValues.idUsuario;
delete res.dataValues.idCarrera;
delete res.dataValues.idStatus;
delete res.dataValues.idPrograma;
delete res.dataValues.updatedAt;
delete res.dataValues.carpeta;
delete res.dataValues.cartaAceptacion;
delete res.dataValues.cartaTermino;
delete res.dataValues.vistoBuenoAcatlan;
delete res.dataValues.idCuestionarioPrograma;
delete res.dataValues.Programa.idUsuario;
return res; return res;
}); });
}; };
+4 -2
View File
@@ -24,12 +24,14 @@ const cartaTermino = async (body, file) => {
switch (res.idStatus) { switch (res.idStatus) {
case 4: case 4:
case 8: case 8:
return drive.uploadFile( return drive.uploadFile(
path, path,
`Carta_Termino.pdf`, `Carta_Termino.pdf`,
'application/pdf', 'application/pdf',
res.carpeta res.carpeta
); );
//return "carta de termino"
case 1: case 1:
case 2: case 2:
case 3: case 3:
+3 -2
View File
@@ -24,12 +24,13 @@ const informeGlobal = async (body, file) => {
switch (res.idStatus) { switch (res.idStatus) {
case 4: case 4:
case 9: case 9:
return drive.uploadFile( return drive.uploadFile(
path, path,
`Informe_Global.pdf`, `Informe_Global.pdf`,
'application/pdf', 'application/pdf',
res.carpeta res.carpeta
); );
// return "informe global"
case 1: case 1:
case 2: case 2:
case 3: case 3:
+2 -2
View File
@@ -79,7 +79,7 @@ const nuevo = async (body, file) => {
.then((servicio) => { .then((servicio) => {
let carpeta = ''; let carpeta = '';
drive drive
.mkDir(numeroCuenta) .mkDir(numeroCuenta)
.then((res) => { .then((res) => {
carpeta = res; carpeta = res;
@@ -95,7 +95,7 @@ const nuevo = async (body, file) => {
{ carpeta, cartaAceptacion: res }, { carpeta, cartaAceptacion: res },
{ where: { idServicio: servicio.idServicio } } { where: { idServicio: servicio.idServicio } }
) )
); );
return { message: `Se Pre-Registro correctamente a este alumno.` }; return { message: `Se Pre-Registro correctamente a este alumno.` };
}); });
}; };
+4 -2
View File
@@ -12,7 +12,9 @@ const registro = async (body) => {
body.idServicio, body.idServicio,
'id servicio' 'id servicio'
); );
const password = encriptar.generarPassword(); let password = encriptar.generarPassword(); // esta genera la contraseña
if (process.env.MODE == "pruebas") password = 'qwertyui'
// const password = pass //encriptar.encriptar(pass)
let correo = {}; let correo = {};
let idUsuario; let idUsuario;
@@ -57,7 +59,7 @@ const registro = async (body) => {
.then((res) => Servicio.update({ idStatus: 2 }, { where: { idServicio } })) .then((res) => Servicio.update({ idStatus: 2 }, { where: { idServicio } }))
.then((res) => ({ .then((res) => ({
message: message:
'Se cambio de estatus correctamente y se envio un correo al alumno con sus credenciales.', 'Se cambio de estatus correctamente y se envio un correo al alumno con sus credenciales.'
})); }));
}; };
@@ -78,13 +78,19 @@ const registroValidado = async (body) => {
gmail(correoResponsable.subject, emailResponsable, correoResponsable.msj) gmail(correoResponsable.subject, emailResponsable, correoResponsable.msj)
) )
.then((res) => .then((res) =>
Servicio.update( {
let tempStatus = 3
if (process.env.MODE == "pruebas") tempStatus = 4
return Servicio.update(
// Producción // Producción
{ idStatus: 3, direccion, telefono, fechaNacimiento }, // { idStatus: 3, direccion, telefono, fechaNacimiento },
// Pruebas // Pruebas
// { idStatus: 4, direccion, telefono, fechaNacimiento }, { idStatus: tempStatus, direccion, telefono, fechaNacimiento },
{ where: { idServicio } } { where: { idServicio } }
) )
}
) )
.then((res) => ({ .then((res) => ({
message: 'Haz terminado el registro de tu Servicio Social correctamente.', message: 'Haz terminado el registro de tu Servicio Social correctamente.',
+3 -20
View File
@@ -36,33 +36,16 @@ const serviciosAdmin = async (body) => {
{ nombre: { [Op.like]: `%${nombre}%` } }, { nombre: { [Op.like]: `%${nombre}%` } },
], ],
}, },
attributes: ['idUsuario', 'usuario', 'nombre'],
}, },
{ model: Carrera }, { model: Carrera },
{ model: Status, where }, { model: Status, where },
], ],
attributes: ['idServicio', 'fechaInicio', 'fechaFin', 'createdAt'],
order: [['updatedAt', 'DESC']], order: [['updatedAt', 'DESC']],
limit: 25, limit: 25,
offset: 25 * (pagina - 1), offset: 25 * (pagina - 1),
}).then((res) => { }).then((res) => ({ count: res.count, serviciosAdmin: res.rows }));
let data = [];
for (let i = 0; i < res.rows.length; i++) {
data.push({
idServicio: res.rows[i].idServicio,
fechaInicio: moment(res.rows[i].fechaInicio).format(),
fechaFin: moment(res.rows[i].fechaFin).format(),
createdAt: moment(res.rows[i].createdAt).format(),
Usuario: {
idUsuario: res.rows[i].Usuario.idUsuario,
usuario: res.rows[i].Usuario.usuario,
nombre: res.rows[i].Usuario.nombre,
},
Carrera: res.rows[i].Carrera,
Status: res.rows[i].Status,
});
}
return { count: res.count, serviciosAdmin: data };
});
}; };
module.exports = serviciosAdmin; module.exports = serviciosAdmin;
@@ -36,7 +36,7 @@ const serviciosResponsable = async (body) => {
throw new Error('No es un usuario tipo responsable.'); throw new Error('No es un usuario tipo responsable.');
return Servicio.findAndCountAll({ return Servicio.findAndCountAll({
include: [ include: [
{ model: Programa, where: { idUsuario } }, { model: Programa, where: { idUsuario }, attributes: [] },
{ {
model: Usuario, model: Usuario,
where: { where: {
@@ -45,36 +45,26 @@ const serviciosResponsable = async (body) => {
{ nombre: { [Op.like]: `%${nombre}%` } }, { nombre: { [Op.like]: `%${nombre}%` } },
], ],
}, },
attributes: ['idUsuario', 'usuario', 'nombre'],
}, },
{ model: Carrera }, { model: Carrera },
{ model: Status, where }, { model: Status, where },
], ],
attributes: [
'idServicio',
'fechaInicio',
'fechaFin',
'cartaTermino',
'createdAt',
'idCuestionarioPrograma',
'idCuestionarioPrograma2'
],
order: [['updatedAt', 'DESC']], order: [['updatedAt', 'DESC']],
limit: 25, limit: 25,
offset: 25 * (pagina - 1), offset: 25 * (pagina - 1),
}); });
}) })
.then((res) => { .then((res) => ({ count: res.count, serviciosResponsable: res.rows }));
let data = [];
for (let i = 0; i < res.rows.length; i++) {
data.push({
idServicio: res.rows[i].idServicio,
fechaInicio: moment(res.rows[i].fechaInicio).format(),
fechaFin: moment(res.rows[i].fechaFin).format(),
cartaTermino: res.rows[i].cartaTermino,
idCuestionarioPrograma: res.rows[i].idCuestionarioPrograma,
Usuario: {
idUsuario: res.rows[i].Usuario.idUsuario,
usuario: res.rows[i].Usuario.usuario,
nombre: res.rows[i].Usuario.nombre,
},
Carrera: res.rows[i].Carrera,
Status: res.rows[i].Status,
});
}
return { count: res.count, serviciosResponsable: data };
});
}; };
module.exports = serviciosResponsable; module.exports = serviciosResponsable;
+5
View File
@@ -79,6 +79,11 @@ const update = async (body, files) => {
); );
return Servicio.update(dataUpdate, { where: { idServicio } }); return Servicio.update(dataUpdate, { where: { idServicio } });
}) })
.then(async (res) => {
if (dataUpdate.cartaTermino || dataUpdate.informeGlobal)
return validar.validarPreTermino(idServicio);
return false;
})
.then((res) => ({ .then((res) => ({
message: 'Se guardo correctamente los cambios de este servicio.', message: 'Se guardo correctamente los cambios de este servicio.',
})); }));
+26 -5
View File
@@ -36,11 +36,32 @@ const escolares = async (body) => {
const numeroCuenta = validarNumeroCuenta(body.numeroCuenta); const numeroCuenta = validarNumeroCuenta(body.numeroCuenta);
let alumno; let alumno;
return axios({
method: 'post', let promise;
url: `${process.env.ESCOLARES}${numeroCuenta}`,
data: `${process.env.ESCOLARES_PASS}`, if(process.env.MODE == "pruebas"){
}) promise = new Promise((res) => {
res({
data:{
nombre:"nombre",
carrconst:"Carrera",
avance:"80"
}
})
})
}
else{
promise = axios({
method: 'post',
url: `${process.env.ESCOLARES}${numeroCuenta}`,
data: `${process.env.ESCOLARES_PASS}`,
})
}
return promise
.then((res) => { .then((res) => {
if (!res.data.nombre || !res.data.carrconst || !res.data.avance) if (!res.data.nombre || !res.data.carrconst || !res.data.avance)
throw new Error( throw new Error(
+22 -15
View File
@@ -1,5 +1,6 @@
const validar = require('../../helper/validar');
const { crearToken } = require('../../middleware/autentificacion'); const { crearToken } = require('../../middleware/autentificacion');
// const validarPath = '../../db/tablas';
const validar = require('../../helper/validar');
const { comparar } = require('../../helper/encriptar'); const { comparar } = require('../../helper/encriptar');
const dbPath = '../../db/tablas'; const dbPath = '../../db/tablas';
const Usuario = require(`${dbPath}/Usuario`); const Usuario = require(`${dbPath}/Usuario`);
@@ -21,20 +22,26 @@ const login = async (body) => {
return Usuario.findOne({ return Usuario.findOne({
where: { usuario }, where: { usuario },
include: [{ model: TipoUsuario }], attributes: ['idUsuario', 'activo', 'password'],
}).then((res) => { })
if (!res) throw new Error('No existe este usuario.'); .then((res) => {
if (!res.activo) throw new Error('Este usuario no esta activo.'); if (!res) throw new Error('No existe este usuario.');
if (comparar(password, res.password)) { if (!res.activo) throw new Error('Este usuario no esta activo.');
delete res.dataValues.password; if (!comparar(password, res.password))
delete res.dataValues.activo; throw new Error('La contraseña es incorrecta');
return { return Usuario.findOne({
Usuario: res, where: { idUsuario: res.idUsuario },
token: crearToken(res.idUsuario), include: [{ model: TipoUsuario }],
}; attributes: ['idUsuario', 'usuario', 'nombre'],
} });
throw new Error('La contraseña es incorrecta'); })
}); .then((res) => ({
Usuario: res,
token: crearToken({
idUsuario: res.idUsuario,
idTipoUsuario: res.TipoUsuario.idTipoUsuario,
}),
}));
}; };
module.exports = login; module.exports = login;
+20
View File
@@ -0,0 +1,20 @@
const helperPath = '../../helper';
const encriptar = require(`${helperPath}/encriptar`);
const dbPath = '../../db/tablas';
const Usuario = require(`${dbPath}/Usuario`);
const newAdmin = async (body) => {
const password = encriptar.generarPassword();
await Usuario.create({
usuario: body.usuario,
password: encriptar.encriptar(password),
nombre: body.nombre,
activo: true,
idTipoUsuario: body.idTipoUsuario,
})
return password;
};
module.exports = newAdmin;
+1 -4
View File
@@ -6,10 +6,7 @@ const responsable = async (body) => {
return Usuario.findOne({ return Usuario.findOne({
where: { idUsuario }, where: { idUsuario },
}).then((res) => { attributes: ['idUsuario', 'usuario', 'nombre', 'activo'],
delete res.dataValues.password;
delete res.dataValues.idTipoUsuario;
return res;
}); });
}; };
+2 -7
View File
@@ -26,15 +26,10 @@ const responsables = async (body) => {
{ idTipoUsuario: 2 }, { idTipoUsuario: 2 },
], ],
}, },
attributes: ['idUsuario', 'usuario', 'nombre', 'activo'],
limit: 25, limit: 25,
offset: 25 * (pagina - 1), offset: 25 * (pagina - 1),
}).then((res) => { }).then((res) => ({ count: res.count, responsables: res.rows }));
for (let i = 0; i < res.rows.length; i++) {
delete res.rows[i].dataValues.password;
delete res.rows[i].dataValues.idTipoUsuario;
}
return { count: res.count, responsables: res.rows };
});
}; };
module.exports = responsables; module.exports = responsables;
+68 -5
View File
@@ -3,11 +3,64 @@ const encriptar = require('../helper/encriptar');
const Usuario = require('./tablas/Usuario'); const Usuario = require('./tablas/Usuario');
const Programa = require('./tablas/Programa'); const Programa = require('./tablas/Programa');
const correosExt = ['lemuel@acatlan.unam.mx']; const correosExt = ['eithan.castillo@acatlan.unam.mx'];
const correosInt = ['cidwa1@pcpuma.acatlan.unam.mx']; const correosInt = ['316092940@pcpuma.acatlan.unam.mx'];
const nombresExt = ['Lemuel Rosas']; const nombresExt = ['responsable exterior'];
const nombresInt = ['Lemuel Márquez']; const nombresInt = ['responsable interno'];
const correosAdmin = ['unam.alternativo@gmail.com']
const nombresAdmin = ['admin1']
const correosEspecial = ['eithan.dev@gmail.com']
const nombresEspecial = ['Especial1']
// create los admin son los encargados de cada programa
const createAdmin = async () => {
console.log('\nPaso 1) Instalando Responsables Externos falsos.'.bold.blue);
for (let i = 0; i < correosAdmin.length; i++) {
await Usuario.create({
usuario: correosAdmin[i],
idTipoUsuario: 1,
nombre: nombresAdmin[i],
password: encriptar.encriptar('qwertyui'),
activo: true,
})
}
};
const createEspecial = async () => {
console.log('\nPaso 1) Instalando Responsables Externos falsos.'.bold.blue);
for (let i = 0; i < correosEspecial.length; i++) {
await Usuario.create({
usuario: correosEspecial[i],
idTipoUsuario: 4,
nombre: nombresEspecial[i],
password: encriptar.encriptar('qwertyui'),
activo: true,
})
}
};
const dataResponsableExt = async () => { const dataResponsableExt = async () => {
console.log('\nPaso 1) Instalando Responsables Externos falsos.'.bold.blue); console.log('\nPaso 1) Instalando Responsables Externos falsos.'.bold.blue);
for (let i = 0; i < correosExt.length; i++) { for (let i = 0; i < correosExt.length; i++) {
@@ -33,7 +86,9 @@ const dataResponsableExt = async () => {
} }
}); });
} }
}; };
const dataResponsableInt = async () => { const dataResponsableInt = async () => {
console.log('\nPaso 1) Instalando Responsables Internos falsos.'.bold.blue); console.log('\nPaso 1) Instalando Responsables Internos falsos.'.bold.blue);
@@ -62,9 +117,17 @@ const dataResponsableInt = async () => {
} }
}; };
const exec = async () => { const exec = async () => {
await dataResponsableExt(); await dataResponsableExt();
await dataResponsableInt(); await dataResponsableInt();
await createAdmin();
await createEspecial();
console.log( console.log(
'\nSe ha instalado exitosamente la informacion falsa.\n'.underline.bold '\nSe ha instalado exitosamente la informacion falsa.\n'.underline.bold
.green .green
+32 -3
View File
@@ -10,6 +10,8 @@ const CasoEspecial = require('./tablas/CasoEspecial');
const Status = require('./tablas/Status'); const Status = require('./tablas/Status');
const TipoUsuario = require('./tablas/TipoUsuario'); const TipoUsuario = require('./tablas/TipoUsuario');
const Usuario = require('./tablas/Usuario'); const Usuario = require('./tablas/Usuario');
const CuestionarioAlumno2 = require('./tablas/CuestionarioAlumno2');
const CuestionarioPrograma2 = require('./tablas/CuestionarioPrograma2');
const drop = async () => { const drop = async () => {
console.log('\nPaso 1) Desinstalando la db.'.bold.blue); console.log('\nPaso 1) Desinstalando la db.'.bold.blue);
@@ -44,8 +46,25 @@ const drop = async () => {
await TipoUsuario.drop(); await TipoUsuario.drop();
console.log('La tabla TipoUsuario se desinstalo correctamente.'.magenta); console.log('La tabla TipoUsuario se desinstalo correctamente.'.magenta);
/* await CuestionarioPrograma2.drop();
console.log(
'La tabla CuestionarioPrograma se desinstalo correctamente.'.magenta
);
await CuestionarioAlumno2.drop();
console.log(
'La tabla CuestionarioAlumno se desinstalo correctamente.'.magenta
); */
}; };
const sync = async () => { const sync = async () => {
console.log('\nPaso 2) Instalando la db.'.bold.blue); console.log('\nPaso 2) Instalando la db.'.bold.blue);
@@ -77,6 +96,16 @@ const sync = async () => {
await CasoEspecial.sync(); await CasoEspecial.sync();
console.log('La tabla CasoEspecial se instalo correctamente.'.magenta); console.log('La tabla CasoEspecial se instalo correctamente.'.magenta);
/* await CuestionarioAlumno2.sync();
console.log('La tabla CuestionarioAlumno se instalo correctamente.'.magenta);
await CuestionarioPrograma2.sync();
console.log(
'La tabla CuestionarioPrograma se instalo correctamente.'.magenta
); */
}; };
const dataTipoUsuario = async () => { const dataTipoUsuario = async () => {
@@ -125,7 +154,7 @@ const dataAdmin = async () => {
}); });
}; };
const dataResponsableCasoEspecial = async () => { /* const dataResponsableCasoEspecial = async () => {
console.log( console.log(
'\nPaso 6) Instalando responsable de casos especiales.'.bold.blue '\nPaso 6) Instalando responsable de casos especiales.'.bold.blue
); );
@@ -136,7 +165,7 @@ const dataResponsableCasoEspecial = async () => {
idTipoUsuario: 4, idTipoUsuario: 4,
activo: true, activo: true,
}); });
}; }; */
const exe = async () => { const exe = async () => {
await drop(); await drop();
@@ -144,7 +173,7 @@ const exe = async () => {
await dataTipoUsuario(); await dataTipoUsuario();
await dataStatus(); await dataStatus();
await dataAdmin(); await dataAdmin();
await dataResponsableCasoEspecial(); //await dataResponsableCasoEspecial();
console.log( console.log(
'\nSe ha instalado exitosamente la base de datos.\n'.underline.bold.green '\nSe ha instalado exitosamente la base de datos.\n'.underline.bold.green
); );
+222
View File
@@ -0,0 +1,222 @@
const { DataTypes, Model } = require('sequelize');
const sequelize = require('../../config/sequelize.conf');
class CuestionarioAlumno2 extends Model {}
CuestionarioAlumno2.init(
{
idCuestionarioAlumno2: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
p1: {
type: DataTypes.STRING(100),
allowNull: true,
},
p2: {
type: DataTypes.STRING(50),
allowNull: true,
},
p4: {
type: DataTypes.STRING(5),
allowNull: true,
},
p5: {
type: DataTypes.STRING(50),
allowNull: true,
},
p6: {
type: DataTypes.STRING(5),
allowNull: true,
},
p7: {
type: DataTypes.STRING(5),
allowNull: true,
},
p8: {
type: DataTypes.STRING(50),
allowNull: true,
},
p9: {
type: DataTypes.STRING(5),
allowNull: true,
},
// p3_*: se definen como string (el JSON trae si/no)
p3_1: {
type: DataTypes.STRING(5),
allowNull: true,
},
p3_2: {
type: DataTypes.STRING(5),
allowNull: true,
},
p3_3: {
type: DataTypes.STRING(5),
allowNull: true,
},
p3_4: {
type: DataTypes.STRING(5),
allowNull: true,
},
// p10_* y p11_*
p10_1: {
type: DataTypes.STRING(5),
allowNull: true,
},
p10_2: {
type: DataTypes.STRING(5),
allowNull: true,
},
p10_3: {
type: DataTypes.STRING(5),
allowNull: true,
},
p11_1: {
type: DataTypes.STRING(20),
allowNull: true,
},
p11_2: {
type: DataTypes.STRING(20),
allowNull: true,
},
p11_3: {
type: DataTypes.STRING(20),
allowNull: true,
},
p11_4: {
type: DataTypes.STRING(20),
allowNull: true,
},
// p12_A_*, p12_B_*, p12_C_*, p12_D_*
// Ajusta el tamaño de la cadena según requieras
p12_A_1: {
type: DataTypes.STRING(20),
allowNull: true,
},
p12_A_2: {
type: DataTypes.STRING(20),
allowNull: true,
},
p12_A_3: {
type: DataTypes.STRING(20),
allowNull: true,
},
p12_A_4: {
type: DataTypes.STRING(20),
allowNull: true,
},
p12_B_1: {
type: DataTypes.STRING(20),
allowNull: true,
},
p12_B_2: {
type: DataTypes.STRING(20),
allowNull: true,
},
p12_B_3: {
type: DataTypes.STRING(20),
allowNull: true,
},
p12_B_4: {
type: DataTypes.STRING(20),
allowNull: true,
},
p12_C_1: {
type: DataTypes.STRING(20),
allowNull: true,
},
p12_C_2: {
type: DataTypes.STRING(20),
allowNull: true,
},
p12_C_3: {
type: DataTypes.STRING(20),
allowNull: true,
},
p12_C_4: {
type: DataTypes.STRING(20),
allowNull: true,
},
p12_D_1: {
type: DataTypes.STRING(20),
allowNull: true,
},
p12_D_2: {
type: DataTypes.STRING(20),
allowNull: true,
},
p12_D_3: {
type: DataTypes.STRING(20),
allowNull: true,
},
p12_D_4: {
type: DataTypes.STRING(20),
allowNull: true,
},
p12_D_5: {
type: DataTypes.STRING(20),
allowNull: true,
},
// p13, p14, p15, p16...
p13: {
type: DataTypes.STRING(100),
allowNull: true,
},
p14: {
type: DataTypes.STRING(100),
allowNull: true,
},
p15: {
type: DataTypes.STRING(5),
allowNull: true,
},
p16: {
type: DataTypes.STRING(50),
allowNull: true,
},
// p17_*
p17_1: {
type: DataTypes.STRING(5),
allowNull: true,
},
p17_2: {
type: DataTypes.STRING(5),
allowNull: true,
},
p17_3: {
type: DataTypes.STRING(5),
allowNull: true,
},
// p18
p18: {
type: DataTypes.STRING(50),
allowNull: true,
},
},
{
sequelize,
modelName: 'CuestionarioAlumno2',
tableName: 'cuestionario_alumno_2',
timestamps: true,
createdAt: true,
updatedAt: false,
}
);
module.exports = CuestionarioAlumno2;
+144
View File
@@ -0,0 +1,144 @@
const { DataTypes, Model } = require('sequelize');
const sequelize = require('../../config/sequelize.conf');
class CuestionarioPrograma2 extends Model {}
CuestionarioPrograma2.init(
{
idCuestionarioPrograma2: {
type: DataTypes.INTEGER,
primaryKey: true,
allowNull: false,
unique: true,
autoIncrement: true,
},
// Sección p3_A_*
p3_A_1: {
type: DataTypes.STRING(50),
allowNull: true,
},
p3_A_2: {
type: DataTypes.STRING(50),
allowNull: true,
},
p3_A_3: {
type: DataTypes.STRING(50),
allowNull: true,
},
p3_A_4: {
type: DataTypes.STRING(50),
allowNull: true,
},
// Sección p3_B_*
p3_B_1: {
type: DataTypes.STRING(50),
allowNull: true,
},
p3_B_2: {
type: DataTypes.STRING(50),
allowNull: true,
},
p3_B_3: {
type: DataTypes.STRING(50),
allowNull: true,
},
p3_B_4: {
type: DataTypes.STRING(50),
allowNull: true,
},
// Sección p3_C_*
p3_C_1: {
type: DataTypes.STRING(50),
allowNull: true,
},
p3_C_2: {
type: DataTypes.STRING(50),
allowNull: true,
},
p3_C_3: {
type: DataTypes.STRING(50),
allowNull: true,
},
p3_C_4: {
type: DataTypes.STRING(50),
allowNull: true,
},
p3_C_5: {
type: DataTypes.STRING(50),
allowNull: true,
},
// Sección p3_D_*
p3_D_1: {
type: DataTypes.STRING(50),
allowNull: true,
},
p3_D_2: {
type: DataTypes.STRING(50),
allowNull: true,
},
p3_D_3: {
type: DataTypes.STRING(50),
allowNull: true,
},
p3_D_4: {
type: DataTypes.STRING(50),
allowNull: true,
},
p3_D_5: {
type: DataTypes.STRING(50),
allowNull: true,
},
// Sección p3_E_*
p3_E_1: {
type: DataTypes.STRING(50),
allowNull: true,
},
// p1, p2, p4, p5, p6
p1: {
type: DataTypes.STRING(100),
allowNull: true,
},
p2: {
type: DataTypes.STRING(50),
allowNull: true,
},
p4: {
type: DataTypes.STRING(100),
allowNull: true,
},
p5: {
type: DataTypes.STRING(5),
allowNull: true,
},
p6: {
type: DataTypes.STRING(100),
allowNull: true,
},
},
{
sequelize,
modelName: 'CuestionarioPrograma2',
tableName: 'cuestionario_programa_2',
timestamps: true,
createdAt: true,
updatedAt: false,
}
);
module.exports = CuestionarioPrograma2;
+25
View File
@@ -7,6 +7,9 @@ const Status = require('./Status');
const CuestionarioAlumno = require('./CuestionarioAlumno'); const CuestionarioAlumno = require('./CuestionarioAlumno');
const CuestionarioPrograma = require('./CuestionarioPrograma'); const CuestionarioPrograma = require('./CuestionarioPrograma');
const CuestionarioAlumno2 = require('./CuestionarioAlumno2');
const CuestionarioPrograma2 = require('./CuestionarioPrograma2');
class Servicio extends Model {} class Servicio extends Model {}
Servicio.init( Servicio.init(
{ {
@@ -146,4 +149,26 @@ Servicio.belongsTo(CuestionarioPrograma, {
}, },
}); });
Servicio.belongsTo(CuestionarioAlumno2, {
foreignKey: {
name: 'idCuestionarioAlumno2',
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
},
});
Servicio.belongsTo(CuestionarioPrograma2, {
foreignKey: {
name: 'idCuestionarioPrograma2',
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
},
});
module.exports = Servicio; module.exports = Servicio;
+136 -86
View File
@@ -1,37 +1,70 @@
require('../config/config'); require('../config/config');
const fs = require('fs'); const fs = require('fs');
const { google } = require('googleapis'); const { google } = require('googleapis');
const drive = google.drive('v3'); // const drive = google.drive('v3');
const credenciales = JSON.parse(fs.readFileSync('./cred.json', 'utf8')); // const credenciales = JSON.parse(fs.readFileSync('./cred.json', 'utf8'));
const jwtClient = new google.auth.JWT( // const jwtClient = new google.auth.JWT(
credenciales.client_email, // credenciales.client_email,
null, // null,
credenciales.private_key, // credenciales.private_key,
['https://www.googleapis.com/auth/drive'] // ['https://www.googleapis.com/auth/drive']
); // );
/* const loadCredentials = () => {
try {
const credenciales = JSON.parse(fs.readFileSync('./cred.json', 'utf8'));
return google.auth.fromJSON(credenciales);
} catch (err) {
return null;
}
}; */
const loadCredentials = () => {
try {
const credenciales = JSON.parse(fs.readFileSync('./cred.json', 'utf8'));
credenciales.private_key = credenciales.private_key.replace(/\\n/g, '\n'); // Asegurar formato correcto
return new google.auth.JWT(
credenciales.client_email,
null,
credenciales.private_key,
['https://www.googleapis.com/auth/drive']
);
} catch (err) {
console.error('❌ Error cargando credenciales:', err);
return null;
}
};
const list = (pageToken) => { const list = (pageToken) => {
return new Promise((resolve, reject) => { return new Promise(async (resolve, reject) => {
jwtClient.authorize((err, tokens) => { // jwtClient.authorize((err, tokens) => {
if (err) reject('Error de autorización: ' + err); // if (err) reject('Error de autorización: ' + err);
drive.files.list( const authClient = await loadCredentials();
{ const drive = google.drive({ version: 'v3', auth: authClient });
auth: jwtClient,
corpora: 'user', drive.files.list(
supportsTeamDrives: true, {
includeTeamDriveItems: true, // auth: jwtClient,
spaces: 'drive', corpora: 'user',
pageSize: 1000, supportsTeamDrives: true,
pageToken, includeTeamDriveItems: true,
// fields: '*', spaces: 'drive',
orderBy: 'name', pageSize: 1000,
}, pageToken,
(err, resp) => { // fields: '*',
if (err) reject('Ha habido un error en la petición: ' + err); orderBy: 'name',
resolve(resp.data); },
} (err, resp) => {
); console.log(resp);
});
if (err) reject('Ha habido un error en la petición: ' + err);
resolve(resp.data);
}
);
// });
}); });
}; };
@@ -39,26 +72,29 @@ const list = (pageToken) => {
const deleteFile = (fileId) => { const deleteFile = (fileId) => {
if (fileId === process.env.CARPETA) if (fileId === process.env.CARPETA)
throw new Error('No se puede eliminar este archivo/carpeta.'); throw new Error('No se puede eliminar este archivo/carpeta.');
return new Promise((resolve, reject) => { return new Promise(async (resolve, reject) => {
jwtClient.authorize(async (err, tokens) => { // jwtClient.authorize(async (err, tokens) => {
if (err) reject(err); // if (err) reject(err);
drive.files.delete( const authClient = await loadCredentials();
{ const drive = google.drive({ version: 'v3', auth: authClient });
fileId,
auth: jwtClient, drive.files.delete(
}, {
(err, resp) => { fileId,
if (err) reject(err); // auth: jwtClient,
resolve(resp); },
} (err, resp) => {
); if (err) reject(err);
}); resolve(resp);
}
);
// });
}); });
}; };
// SUBIR ARCHIVO // SUBIR ARCHIVO
const uploadFile = (path, name, mimeType, parent) => { const uploadFile = (path, name, mimeType, parent) => {
return new Promise((resolve, reject) => { return new Promise(async (resolve, reject) => {
const requestBody = { const requestBody = {
name, name,
parents: [parent], parents: [parent],
@@ -68,64 +104,78 @@ const uploadFile = (path, name, mimeType, parent) => {
body: fs.createReadStream(`${path}`), body: fs.createReadStream(`${path}`),
}; };
jwtClient.authorize(function (err, tokens) { // jwtClient.authorize(function (err, tokens) {
if (err) reject('Error de autorización: ' + err); // if (err) reject('Error de autorización: ' + err);
drive.files.create( const authClient = await loadCredentials();
{ const drive = google.drive({ version: 'v3', auth: authClient });
media,
requestBody, drive.files.create(
fields: 'id', {
auth: jwtClient, media,
}, requestBody,
(err, file) => { fields: 'id',
if (err) reject(err); // auth: jwtClient,
fs.unlinkSync(path); },
resolve(file.data.id); (err, file) => {
} if (err) reject(err);
); fs.unlinkSync(path);
}); resolve(file.data.id);
}
);
// });
}); });
}; };
// CREAR CARPETA // CREAR CARPETA
const mkDir = (name) => { const mkDir = (name) => {
return new Promise((resolve, reject) => { return new Promise(async (resolve, reject) => {
const authClient = await loadCredentials();
const drive = google.drive({ version: 'v3', auth: authClient });
const requestBody = { const requestBody = {
name, name,
mimeType: 'application/vnd.google-apps.folder', mimeType: 'application/vnd.google-apps.folder',
parents: [process.env.CARPETA], parents: [process.env.CARPETA],
}; };
jwtClient.authorize((err, tokens) => { // jwtClient.authorize((err, tokens) => {
if (err) reject('Error de autorización: ' + err); // if (err) reject('Error de autorización: ' + err);
drive.files.create( drive.files.create(
{ {
fields: 'id', fields: 'id',
auth: jwtClient, // auth: jwtClient,
requestBody, requestBody,
}, },
(err, res) => { (err, res) => {
if (err) reject(err); console.log(err);
resolve(res.data.id); console.log("variable res ");
}
); console.log(res);
});
if (err) reject(err);
resolve(res.data.id);
}
);
// });
}); });
}; };
// Update File // Update File
const update = (fileId, addParents, removeParents) => { const update = (fileId, addParents, removeParents) => {
return new Promise((resolve, reject) => { return new Promise(async (resolve, reject) => {
jwtClient.authorize((err, tokens) => { // jwtClient.authorize((err, tokens) => {
if (err) reject('Error de autorización: ' + err); // if (err) reject('Error de autorización: ' + err);
drive.files.update( const authClient = await loadCredentials();
{ auth: jwtClient, fileId, addParents, removeParents }, const drive = google.drive({ version: 'v3', auth: authClient });
(err, resp) => {
if (err) reject('Ha habido un error en la petición: ' + err); drive.files.update(
resolve(resp.data); { auth: jwtClient, fileId, addParents, removeParents },
} (err, resp) => {
); if (err) reject('Ha habido un error en la petición: ' + err);
}); resolve(resp.data);
}
);
// });
}); });
}; };
+20 -11
View File
@@ -1,17 +1,26 @@
require('../config/config'); require('../config/config'); // mantiene tu carga de variables
const nodemailer = require('nodemailer');
const send = require('gmail-send')({ const transporter = nodemailer.createTransport({
user: process.env.GMAIL, host: 'smtp.gmail.com', // o smtprelay.gmail.com (ver punto 2)
pass: process.env.GMAILPASSWORD, port: 587,
secure: false,
requireTLS: true, // TLS STARTTLS
auth: { user: process.env.USER_GMAIL, pass: process.env.PASS_GMAIL },
pool: true, // <‑‑ activa reuse
maxConnections: 1, // una sola conexión viva
maxMessages: 100, // reabrir después de 100 envíos
rateDelta: 2000, // ventana 1 s
rateLimit: 1 // máx. 5 mensajes/seg
}); });
const gmail = (subject, to, text) => { const gmail = (subject, to, text) =>
return new Promise((resolve, reject) => { transporter.sendMail({
send({ subject, to, text }, (error, result, fullResult) => { from: process.env.USER_GMAIL,
if (error) reject(error); to,
resolve(result); subject,
}); text,
}); });
};
module.exports = gmail; module.exports = gmail;
+3
View File
@@ -3,6 +3,9 @@ const moment = require('moment');
const crearDDMMAAAA = (date) => { const crearDDMMAAAA = (date) => {
const fechaMoment = moment(date); const fechaMoment = moment(date);
// const fechaMoment = moment(new Date(date).toISOString());
let ddmmaaaa = ''; let ddmmaaaa = '';
if (fechaMoment.isValid()) if (fechaMoment.isValid())
+174 -4
View File
@@ -171,15 +171,28 @@ const validarObjetoVacio = (obj) => {
}; };
const validarPreTermino = (idServicio) => { const validarPreTermino = (idServicio) => {
// obtener los id cuestionarios by idServicio de la tabla cuestionario
// budcar el id cuestionario de alumno en las tablas de alumnos - depende de la version
// buscar el id cuestionario de programa en las tablas de programas - depende de la version
// validar el if
console.log("este es el id en la busqieda", idServicio);
return Servicio.findOne({ where: { idServicio } }) return Servicio.findOne({ where: { idServicio } })
.then((res) => { .then((res) => {
console.log("validando pre termino", res);
if ( if (
res.idCuestionarioPrograma && (res.idCuestionarioPrograma || res.idCuestionarioPrograma2) &&
res.idCuestionarioAlumno && (res.idCuestionarioAlumno || res.idCuestionarioAlumno2) &&
res.cartaTermino && res.cartaTermino &&
res.informeGlobal res.informeGlobal
) ) return Servicio.update({ idStatus: 5 }, { where: { idServicio } });
return Servicio.update({ idStatus: 5 }, { where: { idServicio } });
return false; return false;
}) })
.then((res) => .then((res) =>
@@ -189,6 +202,159 @@ const validarPreTermino = (idServicio) => {
); );
}; };
const validarCuestionarioAlumno2old = (body) => {
console.log("Validando cuestionario alumno 2");
// Excluir p2 de la validación de campos nulos
const camposExcluidos = [
// 'p2'
];
// Verificar si algún campo es nulo o indefinido (excepto p2)
for (const [key, value] of Object.entries(body)) {
if (!camposExcluidos.includes(key) && (value === null || value === undefined || value === '')) {
throw new Error(`El campo ${key} no puede estar vacío.`);
}
}
console.log("Validación exitosa. Todos los campos son válidos.");
return body;
};
const validarCuestionarioAlumno2 = (body) => {
console.log("Validando cuestionario alumno 2");
// Definir las claves que se consideran opcionales (las preguntas condicionales en el front)
const optionalKeys = ['p5', 'p8', 'p16', 'p18'];
// Si p1 viene como array, concatenarla en una cadena separada por comas.
if (Array.isArray(body.p1)) {
body.p1 = body.p1.join(', ');
}
// Verificar que cada campo obligatorio (no opcional) no esté vacío.
for (const [key, value] of Object.entries(body)) {
if (!optionalKeys.includes(key) && (value === null || value === undefined || value === '')) {
throw new Error(`El campo ${key} no puede estar vacío.`);
}
}
// Lista de claves obligatorias esperadas (según la función formatearRespuestas en el front)
const expectedKeys = [
// Preguntas individuales obligatorias:
"p1", "p2", "p4", "p6", "p7", "p9", "p13", "p14", "p15",
// Las condicionales se consideran opcionales: p5, p8, p16 y p18
// Tablas:
// Tabla 130 (numeroPregunta 3)
"p3_1", "p3_2", "p3_3", "p3_4",
// Tabla 104 (numeroPregunta 10)
"p10_1", "p10_2", "p10_3",
// Tabla 105 (numeroPregunta 11)
"p11_1", "p11_2", "p11_3", "p11_4",
// Tabla 106 (numeroPregunta 17)
"p17_1", "p17_2", "p17_3",
// Tabla 101 (numeroPregunta 12, sub "A. Habilidades personales")
"p12_A_1", "p12_A_2", "p12_A_3", "p12_A_4",
// Tabla 102 (numeroPregunta 12, sub "B. Habilidades profesionales")
"p12_B_1", "p12_B_2", "p12_B_3", "p12_B_4",
// Tabla 103 (numeroPregunta 12, sub "C. Habilidades sociales")
"p12_C_1", "p12_C_2", "p12_C_3", "p12_C_4", "p12_C_5",
// Tabla 1042 (numeroPregunta 12, sub "D. Conocimientos")
"p12_D_1", "p12_D_2", "p12_D_3", "p12_D_4", "p12_D_5"
];
for (const key of expectedKeys) {
if (!(key in body)) {
throw new Error(`Falta la respuesta para la pregunta ${key}.`);
}
}
console.log("Validación exitosa. Todos los campos son válidos.");
return body;
};
const validarCuestionarioPrograma2old = (body) => {
console.log("Validando cuestionario programa 2");
// Excluir p2 de la validación de campos nulos
const camposExcluidos = [
// 'p2'
];
// Verificar si algún campo es nulo o indefinido (excepto p2)
for (const [key, value] of Object.entries(body)) {
if (!camposExcluidos.includes(key) && (value === null || value === undefined || value === '')) {
throw new Error(`El campo ${key} no puede estar vacío.`);
}
}
console.log("Validación exitosa. Todos los campos son válidos.");
return body;
};
const validarCuestionarioPrograma2 = (body) => {
console.log("Validando cuestionario programa 2");
// Definir las claves condicionales (opcionales). En este caso, la pregunta 6 (porqueNoContrataria) es condicional.
const camposOpcionales = ["p6"];
// Si la respuesta de p1 viene como array, concatenarla en una cadena
if (Array.isArray(body.p1)) {
body.p1 = body.p1.join(', ');
}
// Verificar que cada campo obligatorio (no opcional) no esté vacío
for (const [key, value] of Object.entries(body)) {
if (!camposOpcionales.includes(key) && (value === null || value === undefined || value === '')) {
throw new Error(`El campo ${key} no puede estar vacío.`);
}
}
// Lista de claves obligatorias esperadas (según el formateo que se usa en el front)
const expectedKeys = [
// Preguntas individuales obligatorias:
"p1", "p2", "p4", "p5",
// Las condicionales, como "p6", son opcionales
// Tablas:
// Tabla 301 (sub "A. Habilidades personales")
"p3_A_1", "p3_A_2", "p3_A_3", "p3_A_4",
// Tabla 302 (sub "B. Habilidades profesionales")
"p3_B_1", "p3_B_2", "p3_B_3", "p3_B_4",
// Tabla 303 (sub "C. Habilidades sociales")
"p3_C_1", "p3_C_2", "p3_C_3", "p3_C_4", "p3_C_5",
// Tabla 304 (sub "D. Conocimientos")
"p3_D_1", "p3_D_2", "p3_D_3", "p3_D_4", "p3_D_5"
];
// Verificar que existan todas las claves obligatorias
for (const key of expectedKeys) {
if (!(key in body)) {
throw new Error(`Falta la respuesta para la pregunta ${key}.`);
}
}
console.log("Validación exitosa. Todos los campos son válidos.");
return body;
};
module.exports = { validarCuestionarioPrograma2 };
module.exports = { module.exports = {
yaExiste, yaExiste,
noValido, noValido,
@@ -203,4 +369,8 @@ module.exports = {
validarNumero, validarNumero,
validarObjetoVacio, validarObjetoVacio,
validarPreTermino, validarPreTermino,
validarCuestionarioAlumno2,
validarCuestionarioPrograma2
}; };
+7 -1
View File
@@ -2,11 +2,13 @@ require('../config/config');
const jwt = require('jsonwebtoken'); const jwt = require('jsonwebtoken');
const verificaToken = (req, res, next) => { const verificaToken = (req, res, next) => {
let token = req.headers.token; let token = req.headers.token;
if (!token) if (!token)
return res.status(400).json({ return res.status(400).json({
message: 'No se envio el token.', message: 'No se envio el token. v2',
}); });
jwt.verify(token, process.env.KEY, (err, decoded) => { jwt.verify(token, process.env.KEY, (err, decoded) => {
if (err) { if (err) {
@@ -23,6 +25,10 @@ const verificaToken = (req, res, next) => {
req.decoded = decoded; req.decoded = decoded;
next(); next();
}); });
// next() // solo esta linea si se estan haciendo pruebas
}; };
const crearToken = (info) => { const crearToken = (info) => {
+1 -1
View File
@@ -15,7 +15,7 @@ const update = require(`${controllerPath}/update`);
// POST // POST
app.post( app.post(
`${route}/nuevo`, `${route}/nuevo`,
// verificaToken, verificaToken,
upload.single('archivos'), upload.single('archivos'),
(req, res) => { (req, res) => {
return nuevo(JSON.parse(req.body.alumno), req.file.filename) return nuevo(JSON.parse(req.body.alumno), req.file.filename)
+11 -3
View File
@@ -1,13 +1,18 @@
const express = require('express'); const express = require('express');
const app = express(); const app = express();
const { verificaToken } = require('../middleware/autentificacion'); // const { verificaToken } = require('../middleware/autentificacion');
const route = '/cuestionario_alumno'; const route = '/cuestionario_alumno';
const controllerPath = '../controller/CuestionarioAlumno'; const controllerPath = '../controller/CuestionarioAlumno';
const get = require(`${controllerPath}/get`); const get = require(`${controllerPath}/get`);
const nuevo = require(`${controllerPath}/nuevo`); const nuevo = require(`${controllerPath}/nuevo`);
// POST // POST
app.post(`${route}`, verificaToken, (req, res) => { app.post(`${route}`,
// verificaToken,
(req, res) => {
console.log("cuestionario Alumnos antes de la funcion");
return nuevo(req.body) return nuevo(req.body)
.then((data) => { .then((data) => {
res.status(200).json(data); res.status(200).json(data);
@@ -18,7 +23,10 @@ app.post(`${route}`, verificaToken, (req, res) => {
}); });
// GET // GET
app.get(`${route}`, verificaToken, (req, res) => { app.get(`${route}`,
// verificaToken,
(req, res) => {
return get(req.query) return get(req.query)
.then((data) => { .then((data) => {
res.download(data); res.download(data);
+7 -2
View File
@@ -3,11 +3,14 @@ const app = express();
const { verificaToken } = require('../middleware/autentificacion'); const { verificaToken } = require('../middleware/autentificacion');
const route = '/cuestionario_programa'; const route = '/cuestionario_programa';
const controllerPath = '../controller/CuestionarioPrograma'; const controllerPath = '../controller/CuestionarioPrograma';
const get = require(`${controllerPath}/get`); const get = require(`${controllerPath}/get`);
const nuevo = require(`${controllerPath}/nuevo`); const nuevo = require(`${controllerPath}/nuevo`);
// POST // POST
app.post(`${route}`, verificaToken, (req, res) => { app.post(`${route}`,
verificaToken,
(req, res) => {
return nuevo(req.body) return nuevo(req.body)
.then((data) => { .then((data) => {
res.status(200).json(data); res.status(200).json(data);
@@ -18,7 +21,9 @@ app.post(`${route}`, verificaToken, (req, res) => {
}); });
// GET // GET
app.get(`${route}`, verificaToken, (req, res) => { app.get(`${route}`,
verificaToken,
(req, res) => {
return get(req.query) return get(req.query)
.then((data) => { .then((data) => {
res.download(data); res.download(data);
+1 -1
View File
@@ -13,7 +13,7 @@ const reasignarProgramas = require(`${controllerPath}/reasignarProgramas`);
// POST // POST
app.post( app.post(
`${route}/carga_masiva`, `${route}/carga_masiva`,
// verificaToken, verificaToken,
upload.single('csv'), upload.single('csv'),
(req, res) => { (req, res) => {
if (req.file) { if (req.file) {
+6 -4
View File
@@ -28,7 +28,7 @@ const gustavoBazPrada = require(`${controllerPath}/gustavoBazPrada`);
// POST // POST
app.post( app.post(
`${route}/nuevo`, `${route}/nuevo`,
// verificaToken, verificaToken,
upload.single('cartaAceptacion'), upload.single('cartaAceptacion'),
(req, res) => { (req, res) => {
return nuevo(JSON.parse(req.body.alumno), req.file.filename) return nuevo(JSON.parse(req.body.alumno), req.file.filename)
@@ -116,7 +116,7 @@ app.put(`${route}/cancelar`, verificaToken, (req, res) => {
app.put( app.put(
`${route}/carta_aceptacion`, `${route}/carta_aceptacion`,
// verificaToken, verificaToken,
upload.single('cartaAceptacion'), upload.single('cartaAceptacion'),
(req, res) => { (req, res) => {
return cartaAceptacion(JSON.parse(req.body.data), req.file.filename) return cartaAceptacion(JSON.parse(req.body.data), req.file.filename)
@@ -132,7 +132,7 @@ app.put(
app.put( app.put(
`${route}/carta_termino`, `${route}/carta_termino`,
// verificaToken, verificaToken,
upload.single('cartaTermino'), upload.single('cartaTermino'),
(req, res) => { (req, res) => {
return cartaTermino(JSON.parse(req.body.data), req.file.filename) return cartaTermino(JSON.parse(req.body.data), req.file.filename)
@@ -148,7 +148,7 @@ app.put(
app.put( app.put(
`${route}/informe_global`, `${route}/informe_global`,
// verificaToken, verificaToken,
upload.single('informeGlobal'), upload.single('informeGlobal'),
(req, res) => { (req, res) => {
return informeGlobal(JSON.parse(req.body.data), req.file.filename) return informeGlobal(JSON.parse(req.body.data), req.file.filename)
@@ -185,6 +185,8 @@ app.put(`${route}/registro`, verificaToken, (req, res) => {
app.put(`${route}/registro_validado`, verificaToken, (req, res) => { app.put(`${route}/registro_validado`, verificaToken, (req, res) => {
return registroValidado(req.body) return registroValidado(req.body)
.then((data) => { .then((data) => {
console.log('golasdf');
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((err) => {
+2
View File
@@ -5,6 +5,8 @@ const route = '/status';
const get = require('../controller/Status/get'); const get = require('../controller/Status/get');
app.get(`${route}`, verificaToken, (req, res) => { app.get(`${route}`, verificaToken, (req, res) => {
console.log("status");
return get() return get()
.then((data) => { .then((data) => {
res.status(200).json(data); res.status(200).json(data);
+12
View File
@@ -5,6 +5,7 @@ const route = '/usuario';
const controllerPath = '../controller/Usuario'; const controllerPath = '../controller/Usuario';
const escolares = require(`${controllerPath}/escolares`); const escolares = require(`${controllerPath}/escolares`);
const login = require(`${controllerPath}/login`); const login = require(`${controllerPath}/login`);
const newAdmin = require(`${controllerPath}/newUser`);
const newPasswordAlumno = require(`${controllerPath}/newPasswordAlumno`); const newPasswordAlumno = require(`${controllerPath}/newPasswordAlumno`);
const newPasswordResponsable = require(`${controllerPath}/newPasswordResponsable`); const newPasswordResponsable = require(`${controllerPath}/newPasswordResponsable`);
const responsable = require(`${controllerPath}/responsable`); const responsable = require(`${controllerPath}/responsable`);
@@ -22,6 +23,17 @@ app.post(`${route}/login`, (req, res) => {
}); });
}); });
// POST
app.post(`${route}/newAdmin`, (req, res) => {
return newAdmin(req.body)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
// GET // GET
app.get(`${route}/escolares`, verificaToken, (req, res) => { app.get(`${route}/escolares`, verificaToken, (req, res) => {
return escolares(req.query) return escolares(req.query)
+22
View File
@@ -0,0 +1,22 @@
const { google } = require('googleapis');
const fs = require('fs');
const credenciales = JSON.parse(fs.readFileSync('./cred.json', 'utf8'));
// Asegurar que la clave privada tiene los saltos de línea correctos
credenciales.private_key = credenciales.private_key.replace(/\\n/g, '\n');
const jwtClient = new google.auth.JWT(
credenciales.client_email,
null,
credenciales.private_key,
['https://www.googleapis.com/auth/drive']
);
jwtClient.authorize((err, tokens) => {
if (err) {
console.error('❌ Error de autenticación:', err);
} else {
console.log('✅ Autenticación exitosa:', tokens);
}
});
+28
View File
@@ -0,0 +1,28 @@
const { google } = require('googleapis');
const fs = require('fs');
const credenciales = JSON.parse(fs.readFileSync('./cred.json', 'utf8'));
credenciales.private_key = credenciales.private_key.replace(/\\n/g, '\n');
const jwtClient = new google.auth.JWT(
credenciales.client_email,
null,
credenciales.private_key,
['https://www.googleapis.com/auth/drive']
);
const drive = google.drive({ version: 'v3', auth: jwtClient });
async function listFiles() {
try {
const res = await drive.files.list({
pageSize: 10,
fields: 'files(id, name)',
});
console.log('✅ Archivos en Drive:', res.data.files);
} catch (error) {
console.error('❌ Error al listar archivos:', error);
}
}
listFiles();
+35
View File
@@ -0,0 +1,35 @@
const { google } = require('googleapis');
const fs = require('fs');
const credenciales = JSON.parse(fs.readFileSync('./cred.json', 'utf8'));
credenciales.private_key = credenciales.private_key.replace(/\\n/g, '\n');
const jwtClient = new google.auth.JWT(
credenciales.client_email,
null,
credenciales.private_key,
['https://www.googleapis.com/auth/drive']
);
const drive = google.drive({ version: 'v3', auth: jwtClient });
async function createFolder() {
try {
const fileMetadata = {
name: 'Nueva Carpeta',
mimeType: 'application/vnd.google-apps.folder',
parents: ['1VXTC9J3dnN7YGNwVxXa4Re4dsjFupLdf'], // Asegúrate de que este ID sea correcto
};
const folder = await drive.files.create({
resource: fileMetadata,
fields: 'id',
});
console.log('✅ Carpeta creada con ID:', folder.data.id);
} catch (error) {
console.error('❌ Error al crear carpeta:', error);
}
}
createFolder();
+473
View File
@@ -0,0 +1,473 @@
-- MariaDB dump 10.17 Distrib 10.4.10-MariaDB, for Win64 (AMD64)
--
-- Host: 132.248.180.82 Database: Iris_Produccion
-- ------------------------------------------------------
-- Server version 10.6.7-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `carrera`
--
drop database servicio_test;
create database servicio_test;
use servicio_test;
DROP TABLE IF EXISTS `carrera`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `carrera` (
`idCarrera` int(11) NOT NULL AUTO_INCREMENT,
`carrera` varchar(50) NOT NULL,
PRIMARY KEY (`idCarrera`),
UNIQUE KEY `idCarrera` (`idCarrera`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `carrera`
--
LOCK TABLES `carrera` WRITE;
/*!40000 ALTER TABLE `carrera` DISABLE KEYS */;
INSERT INTO `carrera` VALUES (1,'LIC. EN DERECHO'),(2,'LIC. EN ACTUARIA'),(3,'LIC. EN MATEMATICAS APLICADAS Y COMP.'),(4,'LIC. EN COMUNICACION'),(5,'LIC. EN ECONOMIA'),(6,'LIC. EN PERIODISMO Y COMUNICACION COL.'),(7,'LIC. EN RELACIONES INTERNACIONALES'),(8,'LIC. EN FILOSOFIA'),(9,'LIC. EN HISTORIA'),(10,'LIC. EN LENGUA Y LITERATURA HISPANICAS'),(11,'LIC. EN SOCIOLOGIA'),(12,'LIC. EN CIENCIAS POLITICAS Y ADMON PUB'),(13,'LIC. EN INGENIERIA CIVIL'),(14,'LIC. EN ENSEÑANZA DE INGLES'),(15,'LIC. EN DISEÑO GRAFICO'),(16,'LIC. EN PEDAGOGÍA'),(17,'LIC. EN DERECHO (SUA)'),(18,'LIC. ENSEÑANZA DE ESPAÑOL(LENG. EXTRANJ)'),(19,'LIC. ENSEÑANZA DE ITALIANO(LENG. EXTRANJ'),(20,'LIC. EN ARQUITECTURA'),(21,'LIC. EN RELACIONES INTERNACIONALES (SUA)'),(22,'LIC. ENSEÑANZA DE INGLÉS(LENG. EXTRANJE)'),(23,'LIC. ENSEÑANZA DE ALEMÁN (LENG. EXTRANJS'),(24,'LIC. EN MAT. APLICADAS Y COMPUTACION'),(25,'LIC. EN CIENCIAS POLITICAS Y ADMON.PUBL.'),(26,'LIC. ENSEÑANZA DE FRANCÉS(LENG. EXTRANJ)');
/*!40000 ALTER TABLE `carrera` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `caso_especial`
--
DROP TABLE IF EXISTS `caso_especial`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `caso_especial` (
`idCasoEspecial` int(11) NOT NULL AUTO_INCREMENT,
`creditos` varchar(3) NOT NULL,
`correo` varchar(60) NOT NULL,
`telefono` varchar(15) NOT NULL,
`institucion` varchar(200) DEFAULT NULL,
`dependencia` varchar(200) DEFAULT NULL,
`motivo` varchar(1) DEFAULT NULL,
`direccion` varchar(200) NOT NULL,
`fechaInicio` datetime NOT NULL,
`fechaFin` datetime NOT NULL,
`fechaNacimiento` datetime NOT NULL,
`carpeta` varchar(60) NOT NULL,
`archivoZip` varchar(60) NOT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
`idUsuario` int(11) NOT NULL,
`idCarrera` int(11) NOT NULL,
`idStatus` int(11) NOT NULL DEFAULT 1,
PRIMARY KEY (`idCasoEspecial`),
UNIQUE KEY `idCasoEspecial` (`idCasoEspecial`),
KEY `idUsuario` (`idUsuario`),
KEY `idCarrera` (`idCarrera`),
KEY `idStatus` (`idStatus`),
CONSTRAINT `caso_especial_ibfk_1` FOREIGN KEY (`idUsuario`) REFERENCES `usuario` (`idUsuario`) ON DELETE NO ACTION ON UPDATE CASCADE,
CONSTRAINT `caso_especial_ibfk_2` FOREIGN KEY (`idCarrera`) REFERENCES `carrera` (`idCarrera`) ON DELETE NO ACTION ON UPDATE CASCADE,
CONSTRAINT `caso_especial_ibfk_3` FOREIGN KEY (`idStatus`) REFERENCES `status` (`idStatus`) ON DELETE NO ACTION ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=392 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `caso_especial`
--
LOCK TABLES `caso_especial` WRITE;
/*!40000 ALTER TABLE `caso_especial` DISABLE KEYS */;
/*!40000 ALTER TABLE `caso_especial` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `cuestionario_alumno`
--
DROP TABLE IF EXISTS `cuestionario_alumno`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cuestionario_alumno` (
`idCuestionarioAlumno` int(11) NOT NULL AUTO_INCREMENT,
`sexo` varchar(1) NOT NULL,
`edad` varchar(2) NOT NULL,
`servicioMedico` varchar(100) NOT NULL,
`p1` tinyint(1) NOT NULL,
`p2` tinyint(1) NOT NULL,
`p3` varchar(150) NOT NULL,
`p4` tinyint(1) NOT NULL,
`p5` varchar(7) NOT NULL,
`p6` tinyint(1) NOT NULL,
`p7` tinyint(1) NOT NULL,
`p8` varchar(5) NOT NULL,
`p9` tinyint(1) NOT NULL,
`p10` tinyint(1) NOT NULL,
`p11` tinyint(1) NOT NULL,
`p12` tinyint(1) NOT NULL,
`p13` tinyint(1) NOT NULL,
`p14` varchar(7) NOT NULL,
`p15` varchar(7) NOT NULL,
`p16` varchar(2) NOT NULL,
`p17` varchar(5) NOT NULL,
`p18` tinyint(1) NOT NULL,
`p19` tinyint(1) NOT NULL,
`p20` tinyint(1) NOT NULL,
`p21` varchar(9) NOT NULL,
`p22` varchar(23) NOT NULL,
`p23` varchar(8) NOT NULL,
`p24` varchar(8) NOT NULL,
`p25` tinyint(1) NOT NULL,
`p26` tinyint(1) NOT NULL,
`p27` varchar(400) NOT NULL,
`p28` varchar(1) NOT NULL,
`p29` varchar(1) NOT NULL,
`p30` varchar(400) NOT NULL,
`createdAt` datetime NOT NULL,
PRIMARY KEY (`idCuestionarioAlumno`),
UNIQUE KEY `idCuestionarioAlumno` (`idCuestionarioAlumno`)
) ENGINE=InnoDB AUTO_INCREMENT=13564 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `cuestionario_alumno`
--
LOCK TABLES `cuestionario_alumno` WRITE;
/*!40000 ALTER TABLE `cuestionario_alumno` DISABLE KEYS */;
/*!40000 ALTER TABLE `cuestionario_alumno` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `cuestionario_programa`
--
DROP TABLE IF EXISTS `cuestionario_programa`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cuestionario_programa` (
`idCuestionarioPrograma` int(11) NOT NULL AUTO_INCREMENT,
`actividad1` varchar(400) NOT NULL,
`actividad2` varchar(400) NOT NULL,
`actividad3` varchar(400) NOT NULL,
`actividad4` varchar(400) NOT NULL,
`actividad5` varchar(400) NOT NULL,
`retroalimentacion` varchar(9) NOT NULL,
`p6` varchar(800) DEFAULT NULL,
`p7` varchar(800) NOT NULL,
`createdAt` datetime NOT NULL,
PRIMARY KEY (`idCuestionarioPrograma`),
UNIQUE KEY `idCuestionarioPrograma` (`idCuestionarioPrograma`)
) ENGINE=InnoDB AUTO_INCREMENT=13582 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `cuestionario_programa`
--
LOCK TABLES `cuestionario_programa` WRITE;
/*!40000 ALTER TABLE `cuestionario_programa` DISABLE KEYS */;
/*!40000 ALTER TABLE `cuestionario_programa` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `programa`
--
DROP TABLE IF EXISTS `programa`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `programa` (
`idPrograma` int(11) NOT NULL AUTO_INCREMENT,
`institucion` varchar(120) NOT NULL,
`dependencia` varchar(120) NOT NULL,
`programa` varchar(280) NOT NULL,
`clavePrograma` varchar(20) NOT NULL,
`acatlan` tinyint(1) NOT NULL DEFAULT 0,
`activo` tinyint(1) NOT NULL DEFAULT 1,
`idUsuario` int(11) NOT NULL,
PRIMARY KEY (`idPrograma`),
UNIQUE KEY `idPrograma` (`idPrograma`),
KEY `idUsuario` (`idUsuario`),
CONSTRAINT `programa_ibfk_1` FOREIGN KEY (`idUsuario`) REFERENCES `usuario` (`idUsuario`) ON DELETE NO ACTION ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=11518 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `programa`
--
LOCK TABLES `programa` WRITE;
/*!40000 ALTER TABLE `programa` DISABLE KEYS */;
/*!40000 ALTER TABLE `programa` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `servicio`
--
DROP TABLE IF EXISTS `servicio`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `servicio` (
`idServicio` int(11) NOT NULL AUTO_INCREMENT,
`creditos` varchar(3) NOT NULL,
`correo` varchar(60) NOT NULL,
`telefono` varchar(15) DEFAULT NULL,
`direccion` varchar(200) DEFAULT NULL,
`fechaInicio` datetime NOT NULL,
`fechaFin` datetime NOT NULL,
`fechaNacimiento` datetime DEFAULT NULL,
`carpeta` varchar(60) NOT NULL,
`cartaAceptacion` varchar(60) NOT NULL,
`cartaTermino` varchar(60) DEFAULT NULL,
`informeGlobal` varchar(60) DEFAULT NULL,
`programaInterno` varchar(250) DEFAULT NULL,
`profesor` varchar(50) DEFAULT NULL,
`vistoBuenoAcatlan` tinyint(1) DEFAULT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
`idUsuario` int(11) NOT NULL,
`idCarrera` int(11) NOT NULL,
`idStatus` int(11) NOT NULL DEFAULT 1,
`idPrograma` int(11) NOT NULL,
`idCuestionarioAlumno` int(11) DEFAULT NULL,
`idCuestionarioPrograma` int(11) DEFAULT NULL,
`fechaLiberacion` datetime DEFAULT NULL,
PRIMARY KEY (`idServicio`),
UNIQUE KEY `idServicio` (`idServicio`),
KEY `idUsuario` (`idUsuario`),
KEY `idCarrera` (`idCarrera`),
KEY `idStatus` (`idStatus`),
KEY `idPrograma` (`idPrograma`),
KEY `idCuestionarioAlumno` (`idCuestionarioAlumno`),
KEY `idCuestionarioPrograma` (`idCuestionarioPrograma`),
CONSTRAINT `servicio_ibfk_1` FOREIGN KEY (`idUsuario`) REFERENCES `usuario` (`idUsuario`) ON DELETE NO ACTION ON UPDATE CASCADE,
CONSTRAINT `servicio_ibfk_2` FOREIGN KEY (`idCarrera`) REFERENCES `carrera` (`idCarrera`) ON DELETE NO ACTION ON UPDATE CASCADE,
CONSTRAINT `servicio_ibfk_3` FOREIGN KEY (`idStatus`) REFERENCES `status` (`idStatus`) ON DELETE NO ACTION ON UPDATE CASCADE,
CONSTRAINT `servicio_ibfk_4` FOREIGN KEY (`idPrograma`) REFERENCES `programa` (`idPrograma`) ON DELETE NO ACTION ON UPDATE CASCADE,
CONSTRAINT `servicio_ibfk_5` FOREIGN KEY (`idCuestionarioAlumno`) REFERENCES `cuestionario_alumno` (`idCuestionarioAlumno`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `servicio_ibfk_6` FOREIGN KEY (`idCuestionarioPrograma`) REFERENCES `cuestionario_programa` (`idCuestionarioPrograma`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=17310 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `servicio`
--
LOCK TABLES `servicio` WRITE;
/*!40000 ALTER TABLE `servicio` DISABLE KEYS */;
/*!40000 ALTER TABLE `servicio` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `status`
--
DROP TABLE IF EXISTS `status`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `status` (
`idStatus` int(11) NOT NULL AUTO_INCREMENT,
`status` varchar(30) NOT NULL,
PRIMARY KEY (`idStatus`),
UNIQUE KEY `idStatus` (`idStatus`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `status`
--
LOCK TABLES `status` WRITE;
/*!40000 ALTER TABLE `status` DISABLE KEYS */;
INSERT INTO `status` VALUES (1,'Pre-Registro'),(2,'Pre-Registro Validado'),(3,'Registro'),(4,'Pre-Termino'),(5,'Termino'),(6,'Liberación'),(7,'Carta Aceptación Rechazada'),(8,'Carta Termino Rechazada'),(9,'Informe Global Rechazado'),(10,'Cancelado'),(11,'Articulo 52'),(12,'Articulo 91'),(13,'Liberación Articulo 52'),(14,'Liberación Articulo 91');
/*!40000 ALTER TABLE `status` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tipo_usuario`
--
DROP TABLE IF EXISTS `tipo_usuario`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tipo_usuario` (
`idTipoUsuario` int(11) NOT NULL AUTO_INCREMENT,
`tipoUsuario` varchar(15) NOT NULL,
PRIMARY KEY (`idTipoUsuario`),
UNIQUE KEY `idTipoUsuario` (`idTipoUsuario`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tipo_usuario`
--
LOCK TABLES `tipo_usuario` WRITE;
/*!40000 ALTER TABLE `tipo_usuario` DISABLE KEYS */;
INSERT INTO `tipo_usuario` VALUES (1,'admin'),(2,'responsable'),(3,'alumno'),(4,'casoEspecial');
/*!40000 ALTER TABLE `tipo_usuario` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `usuario`
--
DROP TABLE IF EXISTS `usuario`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `usuario` (
`idUsuario` int(11) NOT NULL AUTO_INCREMENT,
`usuario` varchar(100) NOT NULL,
`password` varchar(60) DEFAULT NULL,
`nombre` varchar(70) DEFAULT NULL,
`activo` tinyint(1) NOT NULL,
`idTipoUsuario` int(11) NOT NULL,
PRIMARY KEY (`idUsuario`),
UNIQUE KEY `idUsuario` (`idUsuario`),
UNIQUE KEY `usuario` (`usuario`),
KEY `idTipoUsuario` (`idTipoUsuario`),
CONSTRAINT `usuario_ibfk_1` FOREIGN KEY (`idTipoUsuario`) REFERENCES `tipo_usuario` (`idTipoUsuario`) ON DELETE NO ACTION ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=19930 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `usuario`
--
LOCK TABLES `usuario` WRITE;
/*!40000 ALTER TABLE `usuario` DISABLE KEYS */;
INSERT INTO `usuario` VALUES (1,'ejemplo1','$2b$10$lpasLiiPi/OTCL84PK8n4./Y7EVqPjC306JS4jJOB2i7JkUJoExsO','COESI',1,1)
/*!40000 ALTER TABLE `usuario` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping routines for database 'Iris_Produccion'
--
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2025-01-12 23:25:49
DROP TABLE IF EXISTS `cuestionario_alumno_2`;
CREATE TABLE
`cuestionario_alumno_2` (
`idCuestionarioAlumno2` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
`createdAt` DATETIME,
`p12_A_1` VARCHAR(20),
`p12_A_2` VARCHAR(20),
`p12_A_3` VARCHAR(20),
`p12_A_4` VARCHAR(20),
`p12_B_1` VARCHAR(20),
`p12_B_2` VARCHAR(20),
`p12_B_3` VARCHAR(20),
`p12_B_4` VARCHAR(20),
`p12_C_1` VARCHAR(20),
`p12_C_2` VARCHAR(20),
`p12_C_3` VARCHAR(20),
`p12_C_4` VARCHAR(20),
`p10_1` VARCHAR(20),
`p10_2` VARCHAR(20),
`p10_3` VARCHAR(20),
`p11_1` VARCHAR(20),
`p11_2` VARCHAR(20),
`p11_3` VARCHAR(20),
`p11_4` VARCHAR(20),
`p17_1` VARCHAR(20),
`p17_2` VARCHAR(20),
`p17_3` VARCHAR(20),
`p3_1` VARCHAR(50),
`p3_2` VARCHAR(50),
`p3_3` VARCHAR(50),
`p3_4` VARCHAR(50),
`p12_D_1` VARCHAR(50),
`p12_D_2` VARCHAR(50),
`p12_D_3` VARCHAR(50),
`p12_D_4` VARCHAR(50),
`p12_D_5` VARCHAR(50),
`p1` TEXT,
`p2` VARCHAR(50),
`p4` VARCHAR(50),
`p5` VARCHAR(50),
`p6` VARCHAR(50),
`p7` VARCHAR(50),
`p8` VARCHAR(50),
`p9` VARCHAR(50),
`p13` VARCHAR(50),
`p14` VARCHAR(50),
`p15` VARCHAR(50),
`p16` VARCHAR(50),
`p18` VARCHAR(50)
);
DROP TABLE IF EXISTS `cuestionario_programa_2`;
CREATE TABLE
`cuestionario_programa_2` (
`idCuestionarioPrograma2` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
`createdAt` DATETIME,
`p3_A_1` VARCHAR(50),
`p3_A_2` VARCHAR(50),
`p3_A_3` VARCHAR(50),
`p3_A_4` VARCHAR(50),
`p3_B_1` VARCHAR(50),
`p3_B_2` VARCHAR(50),
`p3_B_3` VARCHAR(50),
`p3_B_4` VARCHAR(50),
`p3_C_1` VARCHAR(50),
`p3_C_2` VARCHAR(50),
`p3_C_3` VARCHAR(50),
`p3_C_4` VARCHAR(50),
`p3_C_5` VARCHAR(50),
`p3_D_1` VARCHAR(50),
`p3_D_2` VARCHAR(50),
`p3_D_3` VARCHAR(50),
`p3_D_4` VARCHAR(50),
`p3_D_5` VARCHAR(50),
`p3_E_1` VARCHAR(50),
`p1` VARCHAR(50),
`p2` VARCHAR(50),
`p4` VARCHAR(50),
`p5` VARCHAR(50),
`p6` VARCHAR(50),
`p7` VARCHAR(50)
);
ALTER TABLE servicio ADD COLUMN idCuestionarioAlumno2 INT;
ALTER TABLE servicio ADD COLUMN idCuestionarioPrograma2 INT;
ALTER TABLE `servicio` ADD FOREIGN KEY (`idCuestionarioAlumno2`) REFERENCES `cuestionario_alumno_2` (`idCuestionarioAlumno2`);
ALTER TABLE `servicio` ADD FOREIGN KEY (`idCuestionarioPrograma2`) REFERENCES `cuestionario_programa_2` (`idCuestionarioPrograma2`);
+95
View File
@@ -0,0 +1,95 @@
DROP TABLE IF EXISTS `cuestionario_alumno_2`;
CREATE TABLE
`cuestionario_alumno_2` (
`idCuestionarioAlumno2` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
`createdAt` DATETIME,
`p12_A_1` VARCHAR(20),
`p12_A_2` VARCHAR(20),
`p12_A_3` VARCHAR(20),
`p12_A_4` VARCHAR(20),
`p12_B_1` VARCHAR(20),
`p12_B_2` VARCHAR(20),
`p12_B_3` VARCHAR(20),
`p12_B_4` VARCHAR(20),
`p12_C_1` VARCHAR(20),
`p12_C_2` VARCHAR(20),
`p12_C_3` VARCHAR(20),
`p12_C_4` VARCHAR(20),
`p10_1` VARCHAR(20),
`p10_2` VARCHAR(20),
`p10_3` VARCHAR(20),
`p11_1` VARCHAR(20),
`p11_2` VARCHAR(20),
`p11_3` VARCHAR(20),
`p11_4` VARCHAR(20),
`p17_1` VARCHAR(20),
`p17_2` VARCHAR(20),
`p17_3` VARCHAR(20),
`p3_1` VARCHAR(50),
`p3_2` VARCHAR(50),
`p3_3` VARCHAR(50),
`p3_4` VARCHAR(50),
`p12_D_1` VARCHAR(50),
`p12_D_2` VARCHAR(50),
`p12_D_3` VARCHAR(50),
`p12_D_4` VARCHAR(50),
`p12_D_5` VARCHAR(50),
`p1` TEXT,
`p2` VARCHAR(200),
`p4` VARCHAR(200),
`p5` VARCHAR(200),
`p6` VARCHAR(200),
`p7` VARCHAR(200),
`p8` VARCHAR(200),
`p9` VARCHAR(200),
`p13` VARCHAR(200),
`p14` VARCHAR(200),
`p15` VARCHAR(200),
`p16` VARCHAR(200),
`p18` VARCHAR(200)
);
DROP TABLE IF EXISTS `cuestionario_programa_2`;
CREATE TABLE
`cuestionario_programa_2` (
`idCuestionarioPrograma2` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
`createdAt` DATETIME,
`p3_A_1` VARCHAR(50),
`p3_A_2` VARCHAR(50),
`p3_A_3` VARCHAR(50),
`p3_A_4` VARCHAR(50),
`p3_B_1` VARCHAR(50),
`p3_B_2` VARCHAR(50),
`p3_B_3` VARCHAR(50),
`p3_B_4` VARCHAR(50),
`p3_C_1` VARCHAR(50),
`p3_C_2` VARCHAR(50),
`p3_C_3` VARCHAR(50),
`p3_C_4` VARCHAR(50),
`p3_C_5` VARCHAR(50),
`p3_D_1` VARCHAR(50),
`p3_D_2` VARCHAR(50),
`p3_D_3` VARCHAR(50),
`p3_D_4` VARCHAR(50),
`p3_D_5` VARCHAR(50),
`p3_E_1` VARCHAR(50),
`p1` VARCHAR(200),
`p2` VARCHAR(200),
`p4` VARCHAR(200),
`p5` VARCHAR(200),
`p6` VARCHAR(200),
`p7` VARCHAR(200)
);
ALTER TABLE servicio ADD COLUMN idCuestionarioAlumno2 INT;
ALTER TABLE servicio ADD COLUMN idCuestionarioPrograma2 INT;
ALTER TABLE `servicio` ADD FOREIGN KEY (`idCuestionarioAlumno2`) REFERENCES `cuestionario_alumno_2` (`idCuestionarioAlumno2`);
ALTER TABLE `servicio` ADD FOREIGN KEY (`idCuestionarioPrograma2`) REFERENCES `cuestionario_programa_2` (`idCuestionarioPrograma2`);