Compare commits
73 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2574b2bf86 | |||
| 0d0cc8f53d | |||
| 1c821addfb | |||
| 0c48921a9b | |||
| 3ba883ef5d | |||
| b2ce341ef1 | |||
| cfd2202dfe | |||
| 573471a33d | |||
| f7763a62e4 | |||
| 4deb3e9093 | |||
| 5aef8dac66 | |||
| 8a24c4368b | |||
| 7bef28e60f | |||
| f89b7e05db | |||
| 7e29a5e5b4 | |||
| f6dc38c00f | |||
| 38afeb084a | |||
| 76092c627f | |||
| 87c311c0c8 | |||
| c547f25a0a | |||
| 8cc4c7d34f | |||
| ab21808ec8 | |||
| 3a3c279080 | |||
| f1d041e891 | |||
| d181790277 | |||
| 493fd83e0e | |||
| 27988f9235 | |||
| 2fc5c1f5fa | |||
| 53786516df | |||
| 329332ad97 | |||
| 73b88b5fde | |||
| 6c7919af90 | |||
| afc29c4208 | |||
| 74e3c265b0 | |||
| 9cc59919f8 | |||
| 620c5da07c | |||
| 6c1d967c8c | |||
| 0aa406fb15 | |||
| 62eb0dc90c | |||
| 46fc456911 | |||
| efb4a7c374 | |||
| a750f1f71b | |||
| 3a7b2a6629 | |||
| 67a23bcef0 | |||
| 3b18b3a8c2 | |||
| bc146595a9 | |||
| 5623c90bda | |||
| a07a77bd8d | |||
| 6130f055b3 | |||
| 339001c6e6 | |||
| 481096e851 | |||
| 9a982a215f | |||
| 661f4985ee | |||
| 0b04777c0c | |||
| 9b153520e8 | |||
| 9fc6e4485a | |||
| 9560014865 | |||
| 7b5e36b402 | |||
| c0f37baf25 | |||
| 998be4bb38 | |||
| 11e7759ae0 | |||
| 97dab2df96 | |||
| 9ea6ad601c | |||
| 841d9b06a5 | |||
| d469b1cdc6 | |||
| fb57ee6b93 | |||
| e82093c967 | |||
| 3bad72ee52 | |||
| 4121f8d0ad | |||
| b4373c770f | |||
| 649aebcac9 | |||
| 50d0758f65 | |||
| 7de43b5daf |
@@ -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"
|
||||
}
|
||||
|
||||
@@ -3,3 +3,4 @@ node_modules/
|
||||
cred.json
|
||||
server/uploads/*
|
||||
|
||||
#.devcontainer
|
||||
+20
@@ -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"]
|
||||
@@ -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',
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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);
|
||||
Generated
+1332
-1571
File diff suppressed because it is too large
Load Diff
@@ -32,6 +32,7 @@
|
||||
"mariadb": "^2.5.1",
|
||||
"moment": "^2.29.1",
|
||||
"multer": "^1.4.2",
|
||||
"nodemailer": "^6.10.1",
|
||||
"sequelize": "^6.3.5",
|
||||
"validator": "^13.1.17"
|
||||
},
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ app.use(bodyParser.json());
|
||||
|
||||
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'));
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ const sequelize = new Sequelize(
|
||||
dialect: process.env.TYPEDB,
|
||||
logging: false,
|
||||
dialectOptions: {
|
||||
useUTC: false,
|
||||
timezone: "America/Mexico_City", // También en dialectOptions
|
||||
},
|
||||
timezone: '-05:00',
|
||||
timezone: '-06:00',
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { validarId } = require('../../helper/validar');
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const CasoEspecial = require(`${dbPath}/CasoEspecial`);
|
||||
@@ -7,21 +7,39 @@ const TipoUsuario = require(`${dbPath}/TipoUsuario`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const admin = async (body) => {
|
||||
const idCasoEspecial = validarId(body.idCasoEspecial);
|
||||
const idCasoEspecial = validarNumeroEntero(
|
||||
body.idCasoEspecial,
|
||||
'id caso especial'
|
||||
);
|
||||
|
||||
return CasoEspecial.findOne({
|
||||
where: { idCasoEspecial },
|
||||
include: [
|
||||
{ model: Usuario, include: [{ model: TipoUsuario }] },
|
||||
{
|
||||
model: Usuario,
|
||||
include: [{ model: TipoUsuario }],
|
||||
attributes: ['idUsuario', 'usuario', 'nombre'],
|
||||
},
|
||||
{ model: Carrera },
|
||||
{ model: Status },
|
||||
],
|
||||
attributes: [
|
||||
'idCasoEspecial',
|
||||
'creditos',
|
||||
'correo',
|
||||
'telefono',
|
||||
'institucion',
|
||||
'dependencia',
|
||||
'motivo',
|
||||
'direccion',
|
||||
'fechaInicio',
|
||||
'fechaFin',
|
||||
'fechaNacimiento',
|
||||
'archivoZip',
|
||||
'createdAt',
|
||||
],
|
||||
}).then((res) => {
|
||||
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;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
const helperPath = '../../helper';
|
||||
const correos = require(`${helperPath}/correos`);
|
||||
const gmail = require(`${helperPath}/gmail`);
|
||||
const { validarId } = require(`${helperPath}/validar`);
|
||||
const { validarNumeroEntero } = require(`${helperPath}/validar`);
|
||||
const dbPath = '../../db/tablas';
|
||||
const CasoEspecial = require(`${dbPath}/CasoEspecial`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const liberacion = async (body) => {
|
||||
const idCasoEspecial = validarId(body.idCasoEspecial);
|
||||
const idCasoEspecial = validarNumeroEntero(
|
||||
body.idCasoEspecial,
|
||||
'id caso especial'
|
||||
);
|
||||
let update = {};
|
||||
|
||||
return CasoEspecial.findOne({
|
||||
@@ -33,7 +36,7 @@ const liberacion = async (body) => {
|
||||
.then((res) => CasoEspecial.update(update, { where: { idCasoEspecial } }))
|
||||
.then((res) => ({
|
||||
message:
|
||||
'Se cambio de estatus correctamente y se envio un correo al alumno informandole de su liberación.',
|
||||
'Se cambió de estatus correctamente y se envió un correo al alumno informandole de su liberación.',
|
||||
}));
|
||||
};
|
||||
|
||||
|
||||
@@ -7,35 +7,49 @@ const CasoEspecial = require(`${dbPath}/CasoEspecial`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const nuevo = async (body, file) => {
|
||||
const idUsuario = validar.validarId(body.idUsuario);
|
||||
const idCarrera = validar.validarId(body.idCarrera);
|
||||
const idStatus = validar.validarId(body.idStatus);
|
||||
const idUsuario = validar.validarNumeroEntero(body.idUsuario, 'id usuario');
|
||||
const idCarrera = validar.validarNumeroEntero(body.idCarrera, 'id carrera');
|
||||
const idStatus = validar.validarNumeroEntero(body.idStatus, 'id status');
|
||||
const numeroCuenta = validar.validarNumeroCuenta(body.numeroCuenta);
|
||||
const creditos = validar.validarNumero(body.creditos);
|
||||
const correo = validar.validarCorreo(body.correo);
|
||||
const telefono = validar.validarNumero(body.telefono, 15);
|
||||
const fechaInicio = validar.validarFecha(body.fechaInicio);
|
||||
const fechaFin = validar.validarFecha(body.fechaFin);
|
||||
const fechaNacimiento = validar.validarFecha(body.fechaNacimiento);
|
||||
const creditos = validar.validarNumero(body.creditos, 'créditos', true);
|
||||
const telefono = validar.validarNumero(body.telefono, 'teléfono', true, 15);
|
||||
const fechaInicio = validar.validarFecha(
|
||||
body.fechaInicio,
|
||||
'fecha de inicio',
|
||||
false
|
||||
);
|
||||
const fechaFin = validar.validarFecha(body.fechaFin, 'fecha fin', false);
|
||||
const fechaNacimiento = validar.validarFecha(
|
||||
body.fechaNacimiento,
|
||||
'fecha de nacimiento',
|
||||
false
|
||||
);
|
||||
const direccion = validar.validarAlfanumerico(
|
||||
body.direccion,
|
||||
'La dirección',
|
||||
'dirección',
|
||||
false,
|
||||
200
|
||||
);
|
||||
const institucion = body.institucion
|
||||
? validar.validarTexto(body.institucion, 'El texto institucion.', 200)
|
||||
? validar.validarTexto(body.institucion, 'institucion', false, 200)
|
||||
: '';
|
||||
const dependencia = body.dependencia
|
||||
? validar.validarTexto(body.dependencia, 'El texto dependencia.', 200)
|
||||
? validar.validarAlfanumerico(body.dependencia, 'dependencia', false, 200)
|
||||
: '';
|
||||
const motivo = body.motivo
|
||||
? validar.validarNumero(body.motivo, 'El texto motivo.', 1)
|
||||
? validar.validarNumero(body.motivo, 'motivo', true, 1)
|
||||
: '';
|
||||
const path = `./server/uploads/${validar.validacionBasicaStr(
|
||||
file,
|
||||
'archivo',
|
||||
true,
|
||||
1000
|
||||
)}`;
|
||||
let carpeta = '';
|
||||
const path = `./server/uploads/${validar.validar(file, 'El archivo', 1000)}`;
|
||||
|
||||
return Usuario.findOne({
|
||||
where: { idUsuario },
|
||||
where: { idUsuario },
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('Este alumno no existe en la db.');
|
||||
|
||||
@@ -7,12 +7,19 @@ const Status = require(`${dbPath}/Status`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const serviciosEspeciales = async (body) => {
|
||||
const pagina = validar.validarNumero(body.pagina, true);
|
||||
const pagina = validar.validarNumero(
|
||||
body.pagina,
|
||||
'página',
|
||||
false,
|
||||
null,
|
||||
true,
|
||||
true
|
||||
);
|
||||
const where = body.idStatus
|
||||
? { idStatus: validar.validarId(body.idStatus) }
|
||||
? { idStatus: validar.validarNumeroEntero(body.idStatus, 'id status') }
|
||||
: { idStatus: { [Op.gt]: 10 } };
|
||||
const nombre = body.nombre
|
||||
? validar.validarTexto(body.nombre, 'El nombre', 60)
|
||||
? validar.validarTexto(body.nombre, 'nombre', true, 60)
|
||||
: '';
|
||||
const numeroCuenta = body.numeroCuenta
|
||||
? validar.validarNumeroCuenta(body.numeroCuenta)
|
||||
@@ -28,19 +35,16 @@ const serviciosEspeciales = async (body) => {
|
||||
{ nombre: { [Op.like]: `%${nombre}%` } },
|
||||
],
|
||||
},
|
||||
attributes: ['idUsuario', 'usuario', 'nombre'],
|
||||
},
|
||||
{ model: Carrera },
|
||||
{ model: Status, where },
|
||||
],
|
||||
attributes: ['idCasoEspecial', 'fechaInicio', 'fechaFin', 'createdAt'],
|
||||
order: [['updatedAt', 'DESC']],
|
||||
limit: 25,
|
||||
offset: 25 * (pagina - 1),
|
||||
}).then((res) => {
|
||||
for (let i = 0; i < res.rows.length; i++) {
|
||||
// delete res.rows[i].dataValues.idUsuario
|
||||
}
|
||||
return { count: res.count, serviciosEspeciales: res.rows };
|
||||
});
|
||||
}).then((res) => ({ count: res.count, serviciosEspeciales: res.rows }));
|
||||
};
|
||||
|
||||
module.exports = serviciosEspeciales;
|
||||
|
||||
@@ -2,7 +2,10 @@ const validar = require('../../helper/validar');
|
||||
const CasoEspecial = require('../../db/tablas/CasoEspecial');
|
||||
|
||||
const update = async (body) => {
|
||||
const idCasoEspecial = validar.validarId(body.idCasoEspecial);
|
||||
const idCasoEspecial = validar.validarNumeroEntero(
|
||||
body.idCasoEspecial,
|
||||
'id caso especial'
|
||||
);
|
||||
const dataUpdate = {};
|
||||
|
||||
return CasoEspecial.findOne({ where: { idCasoEspecial } })
|
||||
@@ -10,45 +13,64 @@ const update = async (body) => {
|
||||
if (!res) throw new Error('Este Caso Especial no existe en la db.');
|
||||
if (body.correo) dataUpdate.correo = validar.validarCorreo(body.correo);
|
||||
if (body.fechaInicio)
|
||||
dataUpdate.fechaInicio = validar.validarFecha(body.fechaInicio);
|
||||
dataUpdate.fechaInicio = validar.validarFecha(
|
||||
body.fechaInicio,
|
||||
'fecha de inicio',
|
||||
false
|
||||
);
|
||||
if (body.fechaFin)
|
||||
dataUpdate.fechaFin = validar.validarFecha(body.fechaFin);
|
||||
dataUpdate.fechaFin = validar.validarFecha(
|
||||
body.fechaFin,
|
||||
'fecha fin',
|
||||
false
|
||||
);
|
||||
if (body.fechaNacimiento)
|
||||
dataUpdate.fechaNacimiento = validar.validarFecha(body.fechaNacimiento);
|
||||
dataUpdate.fechaNacimiento = validar.validarFecha(
|
||||
body.fechaNacimiento,
|
||||
'fecha de nacimiento',
|
||||
false
|
||||
);
|
||||
if (body.direccion)
|
||||
dataUpdate.direccion = validar.validarAlfanumerico(
|
||||
body.direccion,
|
||||
'La dirección',
|
||||
'dirección',
|
||||
false,
|
||||
200
|
||||
);
|
||||
if (body.telefono)
|
||||
dataUpdate.telefono = validar.validarNumero(body.telefono, 15);
|
||||
dataUpdate.telefono = validar.validarNumero(
|
||||
body.telefono,
|
||||
'teléfono',
|
||||
true,
|
||||
15
|
||||
);
|
||||
if (body.institucion)
|
||||
dataUpdate.institucion = validar.validarTexto(
|
||||
body.institucion,
|
||||
'El texto institucion.',
|
||||
'institucion',
|
||||
false,
|
||||
200
|
||||
);
|
||||
if (body.dependencia)
|
||||
dataUpdate.dependencia = validar.validarTexto(
|
||||
body.dependencia,
|
||||
'El texto dependencia.',
|
||||
'dependencia',
|
||||
false,
|
||||
200
|
||||
);
|
||||
if (body.motivo)
|
||||
dataUpdate.motivo = validar.validarNumero(
|
||||
body.motivo,
|
||||
'El texto motivo.',
|
||||
'motivo',
|
||||
true,
|
||||
1
|
||||
);
|
||||
if (validar.validarObjetoVacio(dataUpdate))
|
||||
throw new Error(
|
||||
'No se envio nada para actualizar este Caso Especial.'
|
||||
);
|
||||
throw new Error('No se envio nada para actualizar este caso especial.');
|
||||
return CasoEspecial.update(dataUpdate, { where: { idCasoEspecial } });
|
||||
})
|
||||
.then((res) => ({
|
||||
message: 'Se guardo correctamente los cambios de este servicio.',
|
||||
message: 'Se guardo correctamente los cambios de este caso especial.',
|
||||
}));
|
||||
};
|
||||
|
||||
|
||||
@@ -4,13 +4,16 @@ const helperPath = '../../helper';
|
||||
const helper = require(`${helperPath}/helper`);
|
||||
const { validarNumero } = require(`${helperPath}/validar`);
|
||||
const dbPath = '../../db/tablas';
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const CuestionarioAlumno = require(`${dbPath}/CuestionarioAlumno`);
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
const Servicio = require(`${dbPath}/Servicio`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const get = async (body) => {
|
||||
const year = validarNumero(body.year, 4);
|
||||
const CuestionarioAlumno2 = require(`${dbPath}/CuestionarioAlumno2`);
|
||||
|
||||
const getOld = async (body) => {
|
||||
const year = validarNumero(body.year, 'año', true, 4);
|
||||
const path = `server/uploads/${year}_cuestionario_alumno.csv`;
|
||||
const data = [];
|
||||
|
||||
@@ -22,6 +25,7 @@ const get = async (body) => {
|
||||
},
|
||||
{ model: Programa, where: { clavePrograma: { [Op.like]: `${year}%` } } },
|
||||
{ model: Usuario },
|
||||
{ model: Carrera },
|
||||
],
|
||||
order: [['createdAt']],
|
||||
})
|
||||
@@ -32,6 +36,7 @@ const get = async (body) => {
|
||||
clavePrograma: res[i].Programa.clavePrograma,
|
||||
usuario: res[i].Usuario.usuario,
|
||||
nombre: res[i].Usuario.nombre,
|
||||
carrera: res[i].Carrera.carrera,
|
||||
idCuestionarioAlumno: res[i].CuestionarioAlumno.idCuestionarioAlumno,
|
||||
sexo: res[i].CuestionarioAlumno.sexo,
|
||||
edad: res[i].CuestionarioAlumno.edad,
|
||||
@@ -73,9 +78,71 @@ const get = async (body) => {
|
||||
});
|
||||
return helper.crearArchivo(path, convertArrayToCSV(data));
|
||||
})
|
||||
.then((res) => {
|
||||
return 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;
|
||||
|
||||
@@ -3,8 +3,15 @@ const dbPath = '../../db/tablas';
|
||||
const CuestionarioAlumno = require(`${dbPath}/CuestionarioAlumno`);
|
||||
const Servicio = require(`${dbPath}/Servicio`);
|
||||
|
||||
const nuevo = async (body) => {
|
||||
const idServicio = validar.validarId(body.idServicio);
|
||||
|
||||
const CuestionarioAlumno2 = require(`${dbPath}/CuestionarioAlumno2`);
|
||||
|
||||
|
||||
const nuevoOld = async (body) => {
|
||||
const idServicio = validar.validarNumeroEntero(
|
||||
body.idServicio,
|
||||
'id servicio'
|
||||
);
|
||||
const sexo = body.sexo;
|
||||
const edad = body.edad;
|
||||
const servicioMedico = body.servicioMedico;
|
||||
@@ -158,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;
|
||||
|
||||
@@ -5,13 +5,19 @@ const helperPath = '../../helper';
|
||||
const helper = require(`${helperPath}/helper`);
|
||||
const { validarNumero } = require(`${helperPath}/validar`);
|
||||
const dbPath = '../../db/tablas';
|
||||
const CuestionarioPrograma = require(`${dbPath}/CuestionarioPrograma`);
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const Servicio = require(`${dbPath}/Servicio`);
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const get = async (body) => {
|
||||
const year = validarNumero(body.year, 4);
|
||||
|
||||
const CuestionarioPrograma2 = require(`${dbPath}/CuestionarioPrograma2`);
|
||||
|
||||
|
||||
|
||||
const CuestionarioPrograma = require(`${dbPath}/CuestionarioPrograma`);
|
||||
const getOld = async (body) => {
|
||||
const year = validarNumero(body.year, 'año', true, 4);
|
||||
const path = `server/uploads/${year}_cuestionario_programa.csv`;
|
||||
const data = [];
|
||||
|
||||
@@ -23,6 +29,7 @@ const get = async (body) => {
|
||||
},
|
||||
{ model: Programa, where: { clavePrograma: { [Op.like]: `${year}-%` } } },
|
||||
{ model: Usuario },
|
||||
{ model: Carrera },
|
||||
],
|
||||
order: [['createdAt']],
|
||||
})
|
||||
@@ -33,6 +40,7 @@ const get = async (body) => {
|
||||
clavePrograma: res[i].Programa.clavePrograma,
|
||||
usuario: res[i].Usuario.usuario,
|
||||
nombre: res[i].Usuario.nombre,
|
||||
carrera: res[i].Carrera.carrera,
|
||||
idCuestionarioPrograma:
|
||||
res[i].CuestionarioPrograma.idCuestionarioPrograma,
|
||||
actividad1: res[i].CuestionarioPrograma.actividad1,
|
||||
@@ -50,9 +58,81 @@ const get = async (body) => {
|
||||
});
|
||||
return helper.crearArchivo(path, convertArrayToCSV(data));
|
||||
})
|
||||
.then((res) => {
|
||||
return 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;
|
||||
|
||||
@@ -3,8 +3,16 @@ const dbPath = '../../db/tablas';
|
||||
const CuestionarioPrograma = require(`${dbPath}/CuestionarioPrograma`);
|
||||
const Servicio = require(`${dbPath}/Servicio`);
|
||||
|
||||
const nuevo = async (body) => {
|
||||
const idServicio = validar.validarId(body.idServicio);
|
||||
|
||||
const CuestionarioPrograma2 = require(`${dbPath}/CuestionarioPrograma2`);
|
||||
|
||||
|
||||
|
||||
const nuevoOld = async (body) => {
|
||||
const idServicio = validar.validarNumeroEntero(
|
||||
body.idServicio,
|
||||
'id servicio'
|
||||
);
|
||||
const actividad1 = body.actividad1;
|
||||
const actividad2 = body.actividad2;
|
||||
const actividad3 = body.actividad3;
|
||||
@@ -73,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;
|
||||
|
||||
@@ -133,18 +133,10 @@ const cargaMasiva = async (file) => {
|
||||
mensaje += '\n';
|
||||
}
|
||||
await gmail('Reporte carga masiva', 'lemuel@acatlan.unam.mx', mensaje);
|
||||
// await gmail('Reporte carga masiva', 'dscad@acatlan.unam.mx', mensaje);
|
||||
// await gmail(
|
||||
// 'Reporte carga masiva',
|
||||
// 'tramites.ss@acatlan.unam.mx',
|
||||
// mensaje
|
||||
// );
|
||||
|
||||
fs.unlinkSync(path);
|
||||
});
|
||||
return {
|
||||
message:
|
||||
'Se subio correctamente el archivo csv, se enviará un correo a tramites.ss@acatlan.unam.mx con los detalles de la carga masiva.',
|
||||
message: 'Se subio correctamente el archivo csv para la carga masiva.',
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
const { validarId } = require('../../helper/validar');
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const programasAdmin = async (body) => {
|
||||
const idUsuario = validarId(body.idUsuario);
|
||||
const idUsuario = validarNumeroEntero(body.idUsuario, 'id usuario');
|
||||
|
||||
return Usuario.findOne({
|
||||
where: { idUsuario },
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
const { validarId } = require('../../helper/validar');
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const programasResponsable = async (body) => {
|
||||
const idUsuario = validarId(body.idUsuario);
|
||||
const idUsuario = validarNumeroEntero(body.idUsuario, 'id usuario');
|
||||
|
||||
return Usuario.findOne({
|
||||
where: { idUsuario },
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
const { validarId, validarCorreo } = require('../../helper/validar');
|
||||
const validar = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const reasignarProgramas = async (body) => {
|
||||
const idUsuario = validarId(body.idUsuario);
|
||||
const correoOtroResponsable = validarCorreo(body.correoOtroResponsable);
|
||||
const idUsuario = validar.validarNumeroEntero(body.idUsuario, 'id usuario');
|
||||
const correoOtroResponsable = validar.validarCorreo(
|
||||
body.correoOtroResponsable
|
||||
);
|
||||
let otorResponsable = {};
|
||||
|
||||
return Usuario.findOne({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { validarId } = require('../../helper/validar');
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
@@ -8,24 +8,60 @@ const TipoUsuario = require(`${dbPath}/TipoUsuario`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const admin = async (body) => {
|
||||
const idServicio = validarId(body.idServicio);
|
||||
const idServicio = validarNumeroEntero(body.idServicio, 'id servicio');
|
||||
|
||||
return Servicio.findOne({
|
||||
where: { idServicio },
|
||||
include: [
|
||||
{ model: Usuario, include: [{ model: TipoUsuario }] },
|
||||
{
|
||||
model: Usuario,
|
||||
include: [{ model: TipoUsuario }],
|
||||
attributes: ['idUsuario', 'usuario', 'nombre'],
|
||||
},
|
||||
{ model: Carrera },
|
||||
{ model: Status },
|
||||
{ model: Programa },
|
||||
{
|
||||
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) => {
|
||||
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.idUsuario;
|
||||
delete res.dataValues.idCarrera;
|
||||
delete res.dataValues.idStatus;
|
||||
delete res.dataValues.idPrograma;
|
||||
return res;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const { Op } = require('sequelize');
|
||||
const { validarId } = require('../../helper/validar');
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
@@ -8,7 +8,7 @@ const Status = require(`${dbPath}/Status`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const alumno = async (body) => {
|
||||
let idUsuario = validarId(body.idUsuario);
|
||||
let idUsuario = validarNumeroEntero(body.idUsuario, 'id usuario');
|
||||
|
||||
return Usuario.findOne({ where: { idUsuario } })
|
||||
.then((res) => {
|
||||
@@ -17,22 +17,41 @@ const alumno = async (body) => {
|
||||
throw new Error('No es un usuario de tipo alumno.');
|
||||
return Servicio.findOne({
|
||||
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) => {
|
||||
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;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -8,8 +8,16 @@ const Servicio = require(`${dbPath}/Servicio`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const cancelar = async (body) => {
|
||||
const idServicio = validar.validarId(body.idServicio);
|
||||
const mensaje = validar.validarAlfanumerico(body.mensaje, 'El mensaje', 800);
|
||||
const idServicio = validar.validarNumeroEntero(
|
||||
body.idServicio,
|
||||
'id servicio'
|
||||
);
|
||||
const mensaje = validar.validarAlfanumerico(
|
||||
body.mensaje,
|
||||
'mensaje',
|
||||
true,
|
||||
800
|
||||
);
|
||||
let correoResponsable = {};
|
||||
let correoAlumno = {};
|
||||
let emailResponsable = '';
|
||||
|
||||
@@ -4,8 +4,16 @@ const validar = require(`${helperPath}/validar`);
|
||||
const Servicio = require('../../db/tablas/Servicio');
|
||||
|
||||
const cartaTermino = async (body, file) => {
|
||||
const idServicio = validar.validarId(body.idServicio);
|
||||
const path = `./server/uploads/${validar.validar(file, 'El archivo', 1000)}`;
|
||||
const idServicio = validar.validarNumeroEntero(
|
||||
body.idServicio,
|
||||
'id servicio'
|
||||
);
|
||||
const path = `./server/uploads/${validar.validacionBasicaStr(
|
||||
file,
|
||||
'archivo',
|
||||
true,
|
||||
1000
|
||||
)}`;
|
||||
|
||||
return Servicio.findOne({
|
||||
where: { idServicio },
|
||||
|
||||
@@ -4,8 +4,16 @@ const validar = require(`${helperPath}/validar`);
|
||||
const Servicio = require('../../db/tablas/Servicio');
|
||||
|
||||
const cartaTermino = async (body, file) => {
|
||||
const idServicio = validar.validarId(body.idServicio);
|
||||
const path = `./server/uploads/${validar.validar(file, 'El archivo', 1000)}`;
|
||||
const idServicio = validar.validarNumeroEntero(
|
||||
body.idServicio,
|
||||
'id servicio'
|
||||
);
|
||||
const path = `./server/uploads/${validar.validacionBasicaStr(
|
||||
file,
|
||||
'archivo',
|
||||
true,
|
||||
1000
|
||||
)}`;
|
||||
|
||||
return Servicio.findOne({
|
||||
where: { idServicio },
|
||||
@@ -16,12 +24,14 @@ const cartaTermino = async (body, file) => {
|
||||
switch (res.idStatus) {
|
||||
case 4:
|
||||
case 8:
|
||||
return drive.uploadFile(
|
||||
return drive.uploadFile(
|
||||
path,
|
||||
`Carta_Termino.pdf`,
|
||||
'application/pdf',
|
||||
res.carpeta
|
||||
);
|
||||
);
|
||||
//return "carta de termino"
|
||||
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
|
||||
@@ -10,7 +10,7 @@ const Servicio = require(`${dbPath}/Servicio`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const gustavoBazPrada = async (body) => {
|
||||
const year = validar.validarNumero(body.year, 4);
|
||||
const year = validar.validarNumero(body.year, 'año', true, 4);
|
||||
const inicio = moment(`${year}-01-31`);
|
||||
const fin = moment(`${parseInt(year) + 1}-01-31`);
|
||||
const path = `server/uploads/${year}_gustavo_baz_prada.csv`;
|
||||
|
||||
@@ -4,8 +4,16 @@ const validar = require(`${helperPath}/validar`);
|
||||
const Servicio = require('../../db/tablas/Servicio');
|
||||
|
||||
const informeGlobal = async (body, file) => {
|
||||
const idServicio = validar.validarId(body.idServicio);
|
||||
const path = `./server/uploads/${validar.validar(file, 'El archivo', 1000)}`;
|
||||
const idServicio = validar.validarNumeroEntero(
|
||||
body.idServicio,
|
||||
'id servicio'
|
||||
);
|
||||
const path = `./server/uploads/${validar.validacionBasicaStr(
|
||||
file,
|
||||
'archivo',
|
||||
true,
|
||||
1000
|
||||
)}`;
|
||||
|
||||
return Servicio.findOne({
|
||||
where: { idServicio },
|
||||
@@ -16,12 +24,13 @@ const informeGlobal = async (body, file) => {
|
||||
switch (res.idStatus) {
|
||||
case 4:
|
||||
case 9:
|
||||
return drive.uploadFile(
|
||||
return drive.uploadFile(
|
||||
path,
|
||||
`Informe_Global.pdf`,
|
||||
'application/pdf',
|
||||
res.carpeta
|
||||
);
|
||||
);
|
||||
// return "informe global"
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
|
||||
@@ -9,7 +9,10 @@ const Servicio = require(`${dbPath}/Servicio`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const liberacion = async (body) => {
|
||||
const idServicio = validar.validarId(body.idServicio);
|
||||
const idServicio = validar.validarNumeroEntero(
|
||||
body.idServicio,
|
||||
'id servicio'
|
||||
);
|
||||
const update = { idStatus: 6, fechaLiberacion: moment().format() };
|
||||
let correo = {};
|
||||
|
||||
|
||||
@@ -9,30 +9,40 @@ const Servicio = require(`${dbPath}/Servicio`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const nuevo = async (body, file) => {
|
||||
const idUsuario = validar.validarId(body.idUsuario);
|
||||
const idPrograma = validar.validarId(body.idPrograma);
|
||||
const idCarrera = validar.validarId(body.idCarrera);
|
||||
const idUsuario = validar.validarNumeroEntero(body.idUsuario, 'id usuario');
|
||||
const idPrograma = validar.validarNumeroEntero(
|
||||
body.idPrograma,
|
||||
'id programa'
|
||||
);
|
||||
const idCarrera = validar.validarNumeroEntero(body.idCarrera, 'id carrera');
|
||||
const numeroCuenta = validar.validarNumeroCuenta(body.numeroCuenta);
|
||||
const creditos = validar.validarNumero(body.creditos);
|
||||
const creditos = validar.validarNumero(body.creditos, 'créditos', true);
|
||||
const correo = validar.validarCorreo(body.correo);
|
||||
const fechaInicio = validar.validarFecha(body.fechaInicio);
|
||||
const fechaFin = validar.validarFecha(body.fechaFin);
|
||||
const path = `./server/uploads/${validar.validar(file, 'El archivo', 1000)}`;
|
||||
const fechaInicio = validar.validarFecha(
|
||||
body.fechaInicio,
|
||||
'fecha de inicio',
|
||||
false
|
||||
);
|
||||
const fechaFin = validar.validarFecha(body.fechaFin, 'fecha fin', false);
|
||||
const path = `./server/uploads/${validar.validacionBasicaStr(
|
||||
file,
|
||||
'archivo',
|
||||
true,
|
||||
1000
|
||||
)}`;
|
||||
const programaInterno = body.programaInterno
|
||||
? validar.validarAlfanumerico(
|
||||
body.programaInterno,
|
||||
'El texto programa interno',
|
||||
'programa interno',
|
||||
true,
|
||||
250
|
||||
)
|
||||
: '';
|
||||
const profesor = body.profesor
|
||||
? validar.validarTexto(body.profesor, 'El texto de profesor.', 50)
|
||||
? validar.validarTexto(body.profesor, 'profesor', true, 50)
|
||||
: '';
|
||||
let carpeta = '';
|
||||
|
||||
return Usuario.findOne({
|
||||
where: { idUsuario },
|
||||
})
|
||||
return Usuario.findOne({ where: { idUsuario } })
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('Este alumno no existe en la db.');
|
||||
if (res.idTipoUsuario !== 3)
|
||||
@@ -52,19 +62,7 @@ const nuevo = async (body, file) => {
|
||||
.then(async (res) => {
|
||||
if (res)
|
||||
throw new Error('Este alumno ya tienen un Servicio Social activo.');
|
||||
return drive.folder(numeroCuenta);
|
||||
})
|
||||
.then((res) => {
|
||||
carpeta = res;
|
||||
return drive.uploadFile(
|
||||
path,
|
||||
`Carta_Aceptacion.pdf`,
|
||||
'application/pdf',
|
||||
carpeta
|
||||
);
|
||||
})
|
||||
.then((res) =>
|
||||
Servicio.create({
|
||||
return Servicio.create({
|
||||
idUsuario,
|
||||
idPrograma,
|
||||
idCarrera,
|
||||
@@ -72,15 +70,34 @@ const nuevo = async (body, file) => {
|
||||
correo,
|
||||
fechaInicio: fechaInicio.format(),
|
||||
fechaFin: fechaFin.format(),
|
||||
carpeta,
|
||||
cartaAceptacion: res,
|
||||
carpeta: '',
|
||||
cartaAceptacion: '',
|
||||
profesor,
|
||||
programaInterno,
|
||||
})
|
||||
)
|
||||
.then((res) => ({
|
||||
message: `Se Pre-Registro correctamente al alumno.`,
|
||||
}));
|
||||
});
|
||||
})
|
||||
.then((servicio) => {
|
||||
let carpeta = '';
|
||||
|
||||
drive
|
||||
.mkDir(numeroCuenta)
|
||||
.then((res) => {
|
||||
carpeta = res;
|
||||
return drive.uploadFile(
|
||||
path,
|
||||
`Carta_Aceptacion.pdf`,
|
||||
'application/pdf',
|
||||
carpeta
|
||||
);
|
||||
})
|
||||
.then((res) =>
|
||||
Servicio.update(
|
||||
{ carpeta, cartaAceptacion: res },
|
||||
{ where: { idServicio: servicio.idServicio } }
|
||||
)
|
||||
);
|
||||
return { message: `Se Pre-Registro correctamente a este alumno.` };
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = nuevo;
|
||||
|
||||
@@ -8,8 +8,16 @@ const Servicio = require(`${dbPath}/Servicio`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const cancelar = async (body) => {
|
||||
const idServicio = validar.validarId(body.idServicio);
|
||||
const mensaje = validar.validarAlfanumerico(body.mensaje, 'El mensaje', 800);
|
||||
const idServicio = validar.validarNumeroEntero(
|
||||
body.idServicio,
|
||||
'id servicio'
|
||||
);
|
||||
const mensaje = validar.validarAlfanumerico(
|
||||
body.mensaje,
|
||||
'mensaje',
|
||||
true,
|
||||
800
|
||||
);
|
||||
let correoResponsable = {};
|
||||
let correoAlumno = {};
|
||||
let emailResponsable = '';
|
||||
|
||||
@@ -8,8 +8,16 @@ const Servicio = require(`${dbPath}/Servicio`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const cancelar = async (body) => {
|
||||
const idServicio = validar.validarId(body.idServicio);
|
||||
const mensaje = validar.validarAlfanumerico(body.mensaje, 'El mensaje', 800);
|
||||
const idServicio = validar.validarNumeroEntero(
|
||||
body.idServicio,
|
||||
'id servicio'
|
||||
);
|
||||
const mensaje = validar.validarAlfanumerico(
|
||||
body.mensaje,
|
||||
'mensaje',
|
||||
true,
|
||||
800
|
||||
);
|
||||
let correoResponsable = {};
|
||||
let correoAlumno = {};
|
||||
let emailResponsable = '';
|
||||
|
||||
@@ -8,8 +8,16 @@ const Servicio = require(`${dbPath}/Servicio`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const cancelar = async (body) => {
|
||||
const idServicio = validar.validarId(body.idServicio);
|
||||
const mensaje = validar.validarAlfanumerico(body.mensaje, 'El mensaje', 800);
|
||||
const idServicio = validar.validarNumeroEntero(
|
||||
body.idServicio,
|
||||
'id servicio'
|
||||
);
|
||||
const mensaje = validar.validarAlfanumerico(
|
||||
body.mensaje,
|
||||
'mensaje',
|
||||
true,
|
||||
800
|
||||
);
|
||||
let correoResponsable = {};
|
||||
let correoAlumno = {};
|
||||
let emailResponsable = '';
|
||||
|
||||
@@ -8,8 +8,13 @@ const Servicio = require(`${dbPath}/Servicio`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const registro = async (body) => {
|
||||
const idServicio = validar.validarId(body.idServicio);
|
||||
const password = encriptar.generarPassword();
|
||||
const idServicio = validar.validarNumeroEntero(
|
||||
body.idServicio,
|
||||
'id servicio'
|
||||
);
|
||||
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 idUsuario;
|
||||
|
||||
@@ -54,7 +59,7 @@ const registro = async (body) => {
|
||||
.then((res) => Servicio.update({ idStatus: 2 }, { where: { idServicio } }))
|
||||
.then((res) => ({
|
||||
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.'
|
||||
}));
|
||||
};
|
||||
|
||||
|
||||
@@ -8,12 +8,20 @@ const Servicio = require(`${dbPath}/Servicio`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const registroValidado = async (body) => {
|
||||
const idServicio = validar.validarId(body.idServicio);
|
||||
const fechaNacimiento = validar.validarFecha(body.fechaNacimiento);
|
||||
const telefono = validar.validarNumero(body.telefono, 15);
|
||||
const idServicio = validar.validarNumeroEntero(
|
||||
body.idServicio,
|
||||
'id servicio'
|
||||
);
|
||||
const fechaNacimiento = validar.validarFecha(
|
||||
body.fechaNacimiento,
|
||||
'fecha de nacimiento',
|
||||
false
|
||||
);
|
||||
const telefono = validar.validarNumero(body.telefono, 'teléfono', true, 15);
|
||||
const direccion = validar.validarAlfanumerico(
|
||||
body.direccion,
|
||||
'La dirección',
|
||||
'dirección',
|
||||
false,
|
||||
200
|
||||
);
|
||||
let correoResponsable = {};
|
||||
@@ -70,13 +78,19 @@ const registroValidado = async (body) => {
|
||||
gmail(correoResponsable.subject, emailResponsable, correoResponsable.msj)
|
||||
)
|
||||
.then((res) =>
|
||||
Servicio.update(
|
||||
{
|
||||
|
||||
let tempStatus = 3
|
||||
if (process.env.MODE == "pruebas") tempStatus = 4
|
||||
|
||||
return Servicio.update(
|
||||
// Producción
|
||||
{ idStatus: 3, direccion, telefono, fechaNacimiento },
|
||||
// { idStatus: 3, direccion, telefono, fechaNacimiento },
|
||||
// Pruebas
|
||||
// { idStatus: 4, direccion, telefono, fechaNacimiento },
|
||||
{ idStatus: tempStatus, direccion, telefono, fechaNacimiento },
|
||||
{ where: { idServicio } }
|
||||
)
|
||||
}
|
||||
)
|
||||
.then((res) => ({
|
||||
message: 'Haz terminado el registro de tu Servicio Social correctamente.',
|
||||
|
||||
@@ -11,8 +11,8 @@ const Status = require(`${dbPath}/Status`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const reporte = async (body) => {
|
||||
const inicio = validarFecha(body.inicio);
|
||||
const fin = validarFecha(body.fin);
|
||||
const inicio = validarFecha(body.inicio, 'fecha de inicio', false);
|
||||
const fin = validarFecha(body.fin, 'fecha fin', false);
|
||||
const path = `server/uploads/reporte.csv`;
|
||||
const data = [];
|
||||
|
||||
|
||||
@@ -8,12 +8,19 @@ const Status = require(`${dbPath}/Status`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const serviciosAdmin = async (body) => {
|
||||
const pagina = validar.validarNumero(body.pagina, true);
|
||||
const pagina = validar.validarNumero(
|
||||
body.pagina,
|
||||
'página',
|
||||
false,
|
||||
null,
|
||||
true,
|
||||
true
|
||||
);
|
||||
const where = body.idStatus
|
||||
? { idStatus: validar.validarId(body.idStatus) }
|
||||
? { idStatus: validar.validarNumeroEntero(body.idStatus, 'id status') }
|
||||
: {};
|
||||
const nombre = body.nombre
|
||||
? validar.validarTexto(body.nombre, 'El nombre', 60)
|
||||
? validar.validarTexto(body.nombre, 'nombre', true, 60)
|
||||
: '';
|
||||
const numeroCuenta = body.numeroCuenta
|
||||
? validar.validarNumeroCuenta(body.numeroCuenta)
|
||||
@@ -29,33 +36,16 @@ const serviciosAdmin = async (body) => {
|
||||
{ nombre: { [Op.like]: `%${nombre}%` } },
|
||||
],
|
||||
},
|
||||
attributes: ['idUsuario', 'usuario', 'nombre'],
|
||||
},
|
||||
{ model: Carrera },
|
||||
{ model: Status, where },
|
||||
],
|
||||
attributes: ['idServicio', 'fechaInicio', 'fechaFin', 'createdAt'],
|
||||
order: [['updatedAt', 'DESC']],
|
||||
limit: 25,
|
||||
offset: 25 * (pagina - 1),
|
||||
}).then((res) => {
|
||||
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 };
|
||||
});
|
||||
}).then((res) => ({ count: res.count, serviciosAdmin: res.rows }));
|
||||
};
|
||||
|
||||
module.exports = serviciosAdmin;
|
||||
|
||||
@@ -9,14 +9,21 @@ const Status = require(`${dbPath}/Status`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const serviciosResponsable = async (body) => {
|
||||
const pagina = validar.validarNumero(body.pagina, true);
|
||||
const idUsuario = validar.validarId(body.idUsuario);
|
||||
const pagina = validar.validarNumero(
|
||||
body.pagina,
|
||||
'página',
|
||||
false,
|
||||
null,
|
||||
true,
|
||||
true
|
||||
);
|
||||
const idUsuario = validar.validarNumeroEntero(body.idUsuario, 'id usuario');
|
||||
const where = body.idStatus
|
||||
? { idStatus: validar.validarId(body.idStatus) }
|
||||
? { idStatus: validar.validarNumeroEntero(body.idStatus, 'id status') }
|
||||
: { idStatus: { [Op.ne]: 10 } };
|
||||
|
||||
const nombre = body.nombre
|
||||
? validar.validarTexto(body.nombre, 'El nombre', 60)
|
||||
? validar.validarTexto(body.nombre, 'nombre', true, 60)
|
||||
: '';
|
||||
const numeroCuenta = body.numeroCuenta
|
||||
? validar.validarNumeroCuenta(body.numeroCuenta)
|
||||
@@ -29,7 +36,7 @@ const serviciosResponsable = async (body) => {
|
||||
throw new Error('No es un usuario tipo responsable.');
|
||||
return Servicio.findAndCountAll({
|
||||
include: [
|
||||
{ model: Programa, where: { idUsuario } },
|
||||
{ model: Programa, where: { idUsuario }, attributes: [] },
|
||||
{
|
||||
model: Usuario,
|
||||
where: {
|
||||
@@ -38,36 +45,26 @@ const serviciosResponsable = async (body) => {
|
||||
{ nombre: { [Op.like]: `%${nombre}%` } },
|
||||
],
|
||||
},
|
||||
attributes: ['idUsuario', 'usuario', 'nombre'],
|
||||
},
|
||||
{ model: Carrera },
|
||||
{ model: Status, where },
|
||||
],
|
||||
attributes: [
|
||||
'idServicio',
|
||||
'fechaInicio',
|
||||
'fechaFin',
|
||||
'cartaTermino',
|
||||
'createdAt',
|
||||
'idCuestionarioPrograma',
|
||||
'idCuestionarioPrograma2'
|
||||
],
|
||||
order: [['updatedAt', 'DESC']],
|
||||
limit: 25,
|
||||
offset: 25 * (pagina - 1),
|
||||
});
|
||||
})
|
||||
.then((res) => {
|
||||
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 };
|
||||
});
|
||||
.then((res) => ({ count: res.count, serviciosResponsable: res.rows }));
|
||||
};
|
||||
|
||||
module.exports = serviciosResponsable;
|
||||
|
||||
@@ -4,7 +4,10 @@ const validar = require(`${helperPath}/validar`);
|
||||
const Servicio = require('../../db/tablas/Servicio');
|
||||
|
||||
const update = async (body, files) => {
|
||||
const idServicio = validar.validarId(body.idServicio);
|
||||
const idServicio = validar.validarNumeroEntero(
|
||||
body.idServicio,
|
||||
'id servicio'
|
||||
);
|
||||
const dataUpdate = {};
|
||||
|
||||
return Servicio.findOne({ where: { idServicio } })
|
||||
@@ -39,25 +42,48 @@ const update = async (body, files) => {
|
||||
} catch (err) {}
|
||||
if (body.correo) dataUpdate.correo = validar.validarCorreo(body.correo);
|
||||
if (body.fechaInicio)
|
||||
dataUpdate.fechaInicio = validar.validarFecha(body.fechaInicio);
|
||||
dataUpdate.fechaInicio = validar.validarFecha(
|
||||
body.fechaInicio,
|
||||
'fecha de inicio',
|
||||
false
|
||||
);
|
||||
if (body.fechaFin)
|
||||
dataUpdate.fechaFin = validar.validarFecha(body.fechaFin);
|
||||
dataUpdate.fechaFin = validar.validarFecha(
|
||||
body.fechaFin,
|
||||
'fecha fin',
|
||||
false
|
||||
);
|
||||
if (body.fechaNacimiento)
|
||||
dataUpdate.fechaNacimiento = validar.validarFecha(body.fechaNacimiento);
|
||||
dataUpdate.fechaNacimiento = validar.validarFecha(
|
||||
body.fechaNacimiento,
|
||||
'fecha de nacimiento',
|
||||
false
|
||||
);
|
||||
if (body.direccion)
|
||||
dataUpdate.direccion = validar.validarAlfanumerico(
|
||||
body.direccion,
|
||||
'La dirección',
|
||||
'dirección',
|
||||
false,
|
||||
200
|
||||
);
|
||||
if (body.telefono)
|
||||
dataUpdate.telefono = validar.validarNumero(body.telefono, 15);
|
||||
dataUpdate.telefono = validar.validarNumero(
|
||||
body.telefono,
|
||||
'teléfono',
|
||||
true,
|
||||
15
|
||||
);
|
||||
if (validar.validarObjetoVacio(dataUpdate))
|
||||
throw new Error(
|
||||
'No se envio nada para actualizar este Servicio Social'
|
||||
);
|
||||
return Servicio.update(dataUpdate, { where: { idServicio } });
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (dataUpdate.cartaTermino || dataUpdate.informeGlobal)
|
||||
return validar.validarPreTermino(idServicio);
|
||||
return false;
|
||||
})
|
||||
.then((res) => ({
|
||||
message: 'Se guardo correctamente los cambios de este servicio.',
|
||||
}));
|
||||
|
||||
@@ -4,31 +4,87 @@ const { validarNumeroCuenta } = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const creditosCarreras = [
|
||||
{ carrera: 'LIC. EN ACTUARIA', creditos: 64 },
|
||||
{ carrera: 'LIC. EN ARQUITECTURA', creditos: 70 },
|
||||
{ carrera: 'LIC. EN CIENCIAS POLITICAS Y ADMON PUB', creditos: 67 },
|
||||
{ carrera: 'LIC. EN CIENCIAS POLITICAS Y ADMON.PUBL.', creditos: 67 },
|
||||
{ carrera: 'LIC. EN COMUNICACION', creditos: 67 },
|
||||
{ carrera: 'LIC. EN DERECHO', creditos: 68 },
|
||||
{ carrera: 'LIC. EN DERECHO (SUA)', creditos: 67 },
|
||||
{ carrera: 'LIC. EN DISEÑO GRAFICO', creditos: 70 },
|
||||
{ carrera: 'LIC. EN ECONOMIA', creditos: 66 },
|
||||
{ carrera: 'LIC. EN ENSEÑANZA DE INGLES', creditos: 69 },
|
||||
{ carrera: 'LIC. EN FILOSOFIA', creditos: 70 },
|
||||
{ carrera: 'LIC. EN HISTORIA', creditos: 70 },
|
||||
{ carrera: 'LIC. EN INGENIERIA CIVIL', creditos: 70 },
|
||||
{ carrera: 'LIC. EN LENGUA Y LITERATURA HISPANICAS', creditos: 70 },
|
||||
{ carrera: 'LIC. EN MAT. APLICADAS Y COMPUTACION', creditos: 66 },
|
||||
{ carrera: 'LIC. EN MATEMATICAS APLICADAS Y COMP.', creditos: 66 },
|
||||
{ carrera: 'LIC. EN PEDAGOGÍA', creditos: 70 },
|
||||
{ carrera: 'LIC. EN PERIODISMO Y COMUNICACION COL.', creditos: 70 },
|
||||
{ carrera: 'LIC. EN RELACIONES INTERNACIONALES', creditos: 70 },
|
||||
{ carrera: 'LIC. EN RELACIONES INTERNACIONALES (SUA)', creditos: 70 },
|
||||
{ carrera: 'LIC. EN SOCIOLOGIA', creditos: 68 },
|
||||
{ carrera: 'LIC. ENSEÑANZA DE ALEMÁN (LENG. EXTRANJS', creditos: 70 },
|
||||
{ carrera: 'LIC. ENSEÑANZA DE ESPAÑOL(LENG. EXTRANJ)', creditos: 70 },
|
||||
{ carrera: 'LIC. ENSEÑANZA DE INGLÉS(LENG. EXTRANJE)', creditos: 70 },
|
||||
{ carrera: 'LIC. ENSEÑANZA DE ITALIANO(LENG. EXTRANJ', creditos: 70 },
|
||||
];
|
||||
|
||||
const escolares = async (body) => {
|
||||
const numeroCuenta = validarNumeroCuenta(body.numeroCuenta);
|
||||
let alumno;
|
||||
|
||||
return axios({
|
||||
method: 'post',
|
||||
url: `${process.env.ESCOLARES}${numeroCuenta}`,
|
||||
data: `${process.env.ESCOLARES_PASS}`,
|
||||
})
|
||||
|
||||
let promise;
|
||||
|
||||
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) => {
|
||||
if (!res.data.nombre || !res.data.carrconst || !res.data.avance)
|
||||
throw new Error(
|
||||
'El alumno no cumple con los requisitos para realizar el Servicio Social. Si cree que esto es erroneo comunicate con COESI.'
|
||||
'El alumno no cumple con los requisitos para realizar el Servicio Social. Si cree que esto es erróneo comunícate al Departamento de Servicio Social y Bolsa de Trabajo.'
|
||||
);
|
||||
alumno = {
|
||||
nombre: res.data.nombre.trim(),
|
||||
creditos: res.data.avance,
|
||||
carrera: res.data.carrconst.trim(),
|
||||
};
|
||||
while (alumno.nombre.search('') != -1)
|
||||
alumno.nombre = alumno.nombre.replace('', '');
|
||||
while (alumno.nombre.search('Ã') != -1)
|
||||
for (let i = 0; i < creditosCarreras.length; i++)
|
||||
if (
|
||||
alumno.carrera === creditosCarreras[i].carrera &&
|
||||
Number(alumno.creditos) < creditosCarreras[i].creditos
|
||||
)
|
||||
throw new Error('Este alumno no cuenta con los créditos necesarios.');
|
||||
while (
|
||||
alumno.nombre.search('') != -1 &&
|
||||
alumno.nombre.search('Ã') != -1
|
||||
) {
|
||||
alumno.nombre = alumno.nombre.replace('Ã', 'Ñ');
|
||||
|
||||
alumno.nombre = alumno.nombre.replace('', '');
|
||||
}
|
||||
return Carrera.findOne({ where: { carrera: alumno.carrera } });
|
||||
})
|
||||
.then((res) => {
|
||||
|
||||
@@ -1,34 +1,47 @@
|
||||
const validar = require('../../helper/validar');
|
||||
const { crearToken } = require('../../middleware/autentificacion');
|
||||
// const validarPath = '../../db/tablas';
|
||||
const validar = require('../../helper/validar');
|
||||
const { comparar } = require('../../helper/encriptar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
const TipoUsuario = require(`${dbPath}/TipoUsuario`);
|
||||
|
||||
const login = async (body) => {
|
||||
const usuario = validar.validar(body.usuario, 'El usuario', 60);
|
||||
const usuario = validar.validacionBasicaStr(
|
||||
body.usuario,
|
||||
'usuario',
|
||||
true,
|
||||
60
|
||||
);
|
||||
const password = validar.validarAlfanumerico(
|
||||
body.password,
|
||||
'La contraseña',
|
||||
'contraseña',
|
||||
false,
|
||||
20
|
||||
);
|
||||
|
||||
return Usuario.findOne({
|
||||
where: { usuario },
|
||||
include: [{ model: TipoUsuario }],
|
||||
}).then((res) => {
|
||||
if (!res) throw new Error('No existe este usuario.');
|
||||
if (!res.activo) throw new Error('Este usuario no esta activo.');
|
||||
if (comparar(password, res.password)) {
|
||||
delete res.dataValues.password;
|
||||
delete res.dataValues.activo;
|
||||
return {
|
||||
Usuario: res,
|
||||
token: crearToken(res.idUsuario),
|
||||
};
|
||||
}
|
||||
throw new Error('La contraseña es incorrecta');
|
||||
});
|
||||
attributes: ['idUsuario', 'activo', 'password'],
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('No existe este usuario.');
|
||||
if (!res.activo) throw new Error('Este usuario no esta activo.');
|
||||
if (!comparar(password, res.password))
|
||||
throw new Error('La contraseña es incorrecta');
|
||||
return Usuario.findOne({
|
||||
where: { idUsuario: res.idUsuario },
|
||||
include: [{ model: TipoUsuario }],
|
||||
attributes: ['idUsuario', 'usuario', 'nombre'],
|
||||
});
|
||||
})
|
||||
.then((res) => ({
|
||||
Usuario: res,
|
||||
token: crearToken({
|
||||
idUsuario: res.idUsuario,
|
||||
idTipoUsuario: res.TipoUsuario.idTipoUsuario,
|
||||
}),
|
||||
}));
|
||||
};
|
||||
|
||||
module.exports = login;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const helperPath = '../../helper';
|
||||
const { validarId } = require(`${helperPath}/validar`);
|
||||
const { validarNumeroEntero } = require(`${helperPath}/validar`);
|
||||
const gmail = require(`${helperPath}/gmail`);
|
||||
const correos = require(`${helperPath}/correos`);
|
||||
const encriptar = require(`${helperPath}/encriptar`);
|
||||
@@ -8,7 +8,7 @@ const Usuario = require(`${dbPath}/Usuario`);
|
||||
const Servicio = require(`${dbPath}/Servicio`);
|
||||
|
||||
const newPasswordAlumno = async (body) => {
|
||||
const idServicio = validarId(body.idServicio);
|
||||
const idServicio = validarNumeroEntero(body.idServicio, 'id servicio');
|
||||
const password = encriptar.generarPassword();
|
||||
let idUsuario;
|
||||
let correo = {};
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
const helperPath = '../../helper';
|
||||
const { validarId } = require(`${helperPath}/validar`);
|
||||
const { validarNumeroEntero } = require(`${helperPath}/validar`);
|
||||
const gmail = require(`${helperPath}/gmail`);
|
||||
const correos = require(`${helperPath}/correos`);
|
||||
const encriptar = require(`${helperPath}/encriptar`);
|
||||
const Usuario = require('../../db/tablas/Usuario');
|
||||
|
||||
const newPasswordResponsable = async (body) => {
|
||||
const idUsuario = await validarId(body.idUsuario);
|
||||
const idUsuario = validarNumeroEntero(body.idUsuario, 'id usuario');
|
||||
const password = encriptar.generarPassword();
|
||||
let correo = {};
|
||||
|
||||
|
||||
@@ -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,15 +1,12 @@
|
||||
const { validarId } = require('../../helper/validar');
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
const Usuario = require('../../db/tablas/Usuario');
|
||||
|
||||
const responsable = async (body) => {
|
||||
const idUsuario = validarId(body.idUsuario);
|
||||
const idUsuario = validarNumeroEntero(body.idUsuario, 'id usuario');
|
||||
|
||||
return Usuario.findOne({
|
||||
where: { idUsuario },
|
||||
}).then((res) => {
|
||||
delete res.dataValues.password;
|
||||
delete res.dataValues.idTipoUsuario;
|
||||
return res;
|
||||
attributes: ['idUsuario', 'usuario', 'nombre', 'activo'],
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ const validar = require('../../helper/validar');
|
||||
const Usuario = require('../../db/tablas/Usuario');
|
||||
|
||||
const responsableUpdate = async (body) => {
|
||||
const idUsuario = validar.validarId(body.idUsuario);
|
||||
const idUsuario = validar.validarNumeroEntero(body.idUsuario, 'id usuario');
|
||||
const dataUpdate = {};
|
||||
|
||||
return Usuario.findOne({ where: { idUsuario } })
|
||||
@@ -24,8 +24,12 @@ const responsableUpdate = async (body) => {
|
||||
dataUpdate.usuario = validar.validarCorreo(body.correo);
|
||||
}
|
||||
if (body.nombre)
|
||||
dataUpdate.nombre = validar.validarTexto(body.nombre, 'el nombre', 70);
|
||||
|
||||
dataUpdate.nombre = validar.validarTexto(
|
||||
body.nombre,
|
||||
'nombre',
|
||||
true,
|
||||
70
|
||||
);
|
||||
if (validar.validarObjetoVacio(dataUpdate))
|
||||
throw new Error('No se a envio nada para actualizar.');
|
||||
return Usuario.update(dataUpdate, { where: { idUsuario } });
|
||||
|
||||
@@ -3,12 +3,19 @@ const validar = require('../../helper/validar');
|
||||
const Usuario = require('../../db/tablas/Usuario');
|
||||
|
||||
const responsables = async (body) => {
|
||||
const pagina = validar.validarNumero(body.pagina, true);
|
||||
const pagina = validar.validarNumero(
|
||||
body.pagina,
|
||||
'página',
|
||||
false,
|
||||
null,
|
||||
true,
|
||||
true
|
||||
);
|
||||
const nombre = body.nombre
|
||||
? validar.validarTexto(body.nombre, 'El nombre', 60)
|
||||
? validar.validarTexto(body.nombre, 'nombre', true, 60)
|
||||
: '';
|
||||
const correo = body.correo
|
||||
? validar.validar(body.correo, 'El correo', 1000)
|
||||
? validar.validacionBasicaStr(body.correo, 'correo', true, 1000)
|
||||
: '';
|
||||
|
||||
return Usuario.findAndCountAll({
|
||||
@@ -19,15 +26,10 @@ const responsables = async (body) => {
|
||||
{ idTipoUsuario: 2 },
|
||||
],
|
||||
},
|
||||
attributes: ['idUsuario', 'usuario', 'nombre', 'activo'],
|
||||
limit: 25,
|
||||
offset: 25 * (pagina - 1),
|
||||
}).then((res) => {
|
||||
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 };
|
||||
});
|
||||
}).then((res) => ({ count: res.count, responsables: res.rows }));
|
||||
};
|
||||
|
||||
module.exports = responsables;
|
||||
|
||||
+68
-5
@@ -3,11 +3,64 @@ const encriptar = require('../helper/encriptar');
|
||||
const Usuario = require('./tablas/Usuario');
|
||||
const Programa = require('./tablas/Programa');
|
||||
|
||||
const correosExt = ['lemuel@acatlan.unam.mx'];
|
||||
const correosInt = ['cidwa1@pcpuma.acatlan.unam.mx'];
|
||||
const nombresExt = ['Lemuel Rosas'];
|
||||
const nombresInt = ['Lemuel Márquez'];
|
||||
const correosExt = ['eithan.castillo@acatlan.unam.mx'];
|
||||
const correosInt = ['316092940@pcpuma.acatlan.unam.mx'];
|
||||
const nombresExt = ['responsable exterior'];
|
||||
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 () => {
|
||||
console.log('\nPaso 1) Instalando Responsables Externos falsos.'.bold.blue);
|
||||
for (let i = 0; i < correosExt.length; i++) {
|
||||
@@ -33,7 +86,9 @@ const dataResponsableExt = async () => {
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
const dataResponsableInt = async () => {
|
||||
console.log('\nPaso 1) Instalando Responsables Internos falsos.'.bold.blue);
|
||||
@@ -62,9 +117,17 @@ const dataResponsableInt = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const exec = async () => {
|
||||
await dataResponsableExt();
|
||||
await dataResponsableInt();
|
||||
await createAdmin();
|
||||
await createEspecial();
|
||||
|
||||
console.log(
|
||||
'\nSe ha instalado exitosamente la informacion falsa.\n'.underline.bold
|
||||
.green
|
||||
|
||||
+32
-3
@@ -10,6 +10,8 @@ const CasoEspecial = require('./tablas/CasoEspecial');
|
||||
const Status = require('./tablas/Status');
|
||||
const TipoUsuario = require('./tablas/TipoUsuario');
|
||||
const Usuario = require('./tablas/Usuario');
|
||||
const CuestionarioAlumno2 = require('./tablas/CuestionarioAlumno2');
|
||||
const CuestionarioPrograma2 = require('./tablas/CuestionarioPrograma2');
|
||||
|
||||
const drop = async () => {
|
||||
console.log('\nPaso 1) Desinstalando la db.'.bold.blue);
|
||||
@@ -44,8 +46,25 @@ const drop = async () => {
|
||||
|
||||
await TipoUsuario.drop();
|
||||
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 () => {
|
||||
console.log('\nPaso 2) Instalando la db.'.bold.blue);
|
||||
|
||||
@@ -77,6 +96,16 @@ const sync = async () => {
|
||||
|
||||
await CasoEspecial.sync();
|
||||
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 () => {
|
||||
@@ -125,7 +154,7 @@ const dataAdmin = async () => {
|
||||
});
|
||||
};
|
||||
|
||||
const dataResponsableCasoEspecial = async () => {
|
||||
/* const dataResponsableCasoEspecial = async () => {
|
||||
console.log(
|
||||
'\nPaso 6) Instalando responsable de casos especiales.'.bold.blue
|
||||
);
|
||||
@@ -136,7 +165,7 @@ const dataResponsableCasoEspecial = async () => {
|
||||
idTipoUsuario: 4,
|
||||
activo: true,
|
||||
});
|
||||
};
|
||||
}; */
|
||||
|
||||
const exe = async () => {
|
||||
await drop();
|
||||
@@ -144,7 +173,7 @@ const exe = async () => {
|
||||
await dataTipoUsuario();
|
||||
await dataStatus();
|
||||
await dataAdmin();
|
||||
await dataResponsableCasoEspecial();
|
||||
//await dataResponsableCasoEspecial();
|
||||
console.log(
|
||||
'\nSe ha instalado exitosamente la base de datos.\n'.underline.bold.green
|
||||
);
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -7,6 +7,9 @@ const Status = require('./Status');
|
||||
const CuestionarioAlumno = require('./CuestionarioAlumno');
|
||||
const CuestionarioPrograma = require('./CuestionarioPrograma');
|
||||
|
||||
const CuestionarioAlumno2 = require('./CuestionarioAlumno2');
|
||||
const CuestionarioPrograma2 = require('./CuestionarioPrograma2');
|
||||
|
||||
class Servicio extends Model {}
|
||||
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;
|
||||
|
||||
+76
-35
@@ -1,4 +1,10 @@
|
||||
const dudas = `Cualquier duda puedes acudir al área de Registro y Control de Servicio Social en COESI de Lunes a Viernes de 10:00 a 14:00 hrs y de 16:00 a 20:00 hrs, o bien, comunicarte al 5623 1686 o al correo registross@acatlan.unam.mx`;
|
||||
const dudasAlumno = `Cualquier duda puedes acudir a las ventanillas de servicio social de la Secretaría de Asuntos Académicos Estudiantiles, en la planta baja del Edificio A-8 de lunes a viernes de 09:00 a 15:00 hrs. y de 17:00 a 19:00 hrs. o bien, comunicarte al 5623 1686 o al correo tramites.ss@acatlan.unam.mx`;
|
||||
const dudasResponsable = `Cualquier duda puede comunicarse al 5623 1686 o al correo tramites.ss@acatlan.unam.mx`;
|
||||
const atentamente = `
|
||||
Atentamente
|
||||
Departamento de Servicio Social, Desarrollo Profesional e Inserción Laboral
|
||||
FES Acatlán
|
||||
`;
|
||||
|
||||
const preRegistro = (password, nombre) => {
|
||||
return {
|
||||
@@ -6,17 +12,23 @@ const preRegistro = (password, nombre) => {
|
||||
msj: `Estimado(a) ${nombre}:
|
||||
|
||||
Te informamos que la dependencia en donde decidiste realizar tu servicio social ya te registró en nuestro sistema de servicio social, por lo que para completar el proceso debes ingresar en un periodo máximo de 10 días hábiles a partir de la recepción de este mensaje, a la página https://iris.acatlan.unam.mx/ con tu número de cuenta y contraseña: ${password}, para llenar un formulario con tus datos.
|
||||
|
||||
En caso de no realizar dicho registro, tu trámite queda inconcluso y no nos hacemos responsables por las horas de servicio social prestadas en cualquier dependencia.
|
||||
|
||||
En el sistema que se te indicó podrás dar seguimiento al resto de tu trámite de servicio social.
|
||||
Cualquier duda puedes acudir al área de Registro y Control de Servicio Social en COESI de lunes a viernes de 10:00 a 13:00 hrs. y de 16:00 a 19:00 hrs. o bien, comunicarte al 5623 1686 o al correo tramites.ss@acatlan.unam.mx
|
||||
|
||||
Instrucciones al término de tu servicio social:
|
||||
|
||||
Al día siguiente de tu fecha de término programada, quedará habilitado en el sistema la opción para subir los documentos correspondientes, por lo que la institución deberá subir escaneada tu carta de término y llenar un cuestionario sobre tu desempeño, mientras que tú debes encargarte de subir tu informe global de actividades en el formato disponible en http://bit.ly/informeglobal-FESA, así como llenar un cuestionario sobre el programa en el que participaste.
|
||||
Al día siguiente de tu fecha de término programada, quedará habilitado en el sistema la opción para subir los documentos correspondientes, por lo que la institución deberá subir escaneada tu carta de término y llenar un cuestionario sobre tu desempeño, mientras que tú debes encargarte de subir tu informe global de actividades en el formato disponible en https://bit.ly/informe-serviciosocialFESA, así como llenar un cuestionario sobre el programa en el que participaste.
|
||||
|
||||
Si se suben correctamente los documentos y cuestionarios mencionados, el Departamento de Servicio Social validará tu trámite de término en el sistema y en un periodo aproximado de 15 días hábiles te hará llegar por correo electrónico tu carta de liberación del servicio social.
|
||||
|
||||
Finalmente, te recomendamos destacar en tu bandeja de correos este mensaje para tener siempre a la mano las instrucciones recibidas, o bien, copiar en otro archivo el texto para que lo puedas ubicar fácilmente.
|
||||
|
||||
${dudas}`,
|
||||
${dudasAlumno}
|
||||
|
||||
${atentamente}
|
||||
`,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -29,7 +41,10 @@ Te informamos que hay un error con tu pre-registro de servicio social por los si
|
||||
|
||||
${motivo}
|
||||
|
||||
${dudas}`,
|
||||
${dudasAlumno}
|
||||
|
||||
${atentamente}
|
||||
`,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -37,11 +52,15 @@ const preRegistroRechazadoResponsable = (motivo, nombre) => {
|
||||
return {
|
||||
subject: `Notificación de rechazo de pre-registro.`,
|
||||
msj: `Estimado responsable de programa:
|
||||
|
||||
Te informamos que hubo un error con el pre-registro de servicio social del alumno ${nombre} por los siguientes motivos:
|
||||
|
||||
${motivo}
|
||||
|
||||
${dudas}`,
|
||||
${dudasResponsable}
|
||||
|
||||
${atentamente}
|
||||
`,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -56,7 +75,10 @@ A su vez, deberás responder un cuestionario de evaluación del programa de serv
|
||||
|
||||
Cabe mencionar que se ha enviado copia de este mensaje al responsable de programa de servicio social de tu dependencia para que esté enterado de la validación de tu registro.
|
||||
|
||||
${dudas}`,
|
||||
${dudasAlumno}
|
||||
|
||||
${atentamente}
|
||||
`,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -67,7 +89,10 @@ const registroValidadoResponsable = (nombre) => {
|
||||
|
||||
Te informamos que el Área de Registro y Control de Servicio Social ha validado la solicitud de registro del alumno ${nombre}.
|
||||
|
||||
${dudas}`,
|
||||
${dudasResponsable}
|
||||
|
||||
${atentamente}
|
||||
`,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -76,9 +101,12 @@ const terminoValidado = (nombre) => {
|
||||
subject: 'Validación de término.',
|
||||
msj: `Estimado(a) ${nombre}:
|
||||
|
||||
Te confirmamos que has concluido con los trámites necesarios para la liberación de tu servicio social por lo que ahora solo queda esperar máximo 15 días hábiles para que se te notifique por correo electrónico, a partir de cuándo puedes recoger la copia de tu carta de liberación en las ventanillas del Área de Registro y Control de Servicio Social.
|
||||
Te confirmamos que has concluido con los trámites necesarios para la liberación de tu servicio social por lo que ahora solo queda esperar máximo 15 días hábiles para que se te envíe a tu correo, la copia de tu carta de liberación.
|
||||
|
||||
${dudas}`,
|
||||
${dudasAlumno}
|
||||
|
||||
${atentamente}
|
||||
`,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -91,7 +119,10 @@ Te informamos que no fue validado tu trámite de término por el Departamento de
|
||||
|
||||
${motivo}
|
||||
|
||||
${dudas}`,
|
||||
${dudasAlumno}
|
||||
|
||||
${atentamente}
|
||||
`,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -99,11 +130,15 @@ const terminoRechazadoResponsable = (motivo, nombre) => {
|
||||
return {
|
||||
subject: 'Correo de rechazo de término',
|
||||
msj: `Estimado responsable de programa:
|
||||
|
||||
Te informamos que no fue validado el trámite de término del alumno ${nombre} por el Departamento de Servicio Social y Bolsa de Trabajo por los siguientes motivos:
|
||||
|
||||
${motivo}
|
||||
|
||||
${dudas}`,
|
||||
${dudasResponsable}
|
||||
|
||||
${atentamente}
|
||||
`,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -116,7 +151,10 @@ Te informamos que fue cancelado tu trámite de servicio social, por el Departame
|
||||
|
||||
${motivo}
|
||||
|
||||
${dudas}`,
|
||||
${dudasAlumno}
|
||||
|
||||
${atentamente}
|
||||
`,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -128,16 +166,19 @@ Te informamos que fue cancelado el trámite de servicio social del alumno ${nomb
|
||||
|
||||
${motivo}
|
||||
|
||||
${dudas}`,
|
||||
${dudasResponsable}
|
||||
|
||||
${atentamente}
|
||||
`,
|
||||
};
|
||||
};
|
||||
|
||||
const enviarSec = (secreto, usuariomail, nombre) => {
|
||||
return {
|
||||
subject: `Estimado responsable de programa de servicio social: ${nombre}`,
|
||||
msj: `Como ya se les había informado, en nuestra Facultad estamos en un proceso de actualización administrativa que implica la puesta en marcha de un nuevo sistema interno de servicio social en el cual estará el expediente electrónico del alumno y su seguimiento con respecto a estos trámites. La dirección electrónica de dicho sistema es https://iris.acatlan.unam.mx y su usuario y contraseña son:
|
||||
msj: `Le informamos que desde marzo de 2020 se implementó un nuevo sistema interno de servicio social en el cual estará el expediente electrónico del alumno y su seguimiento con respecto a estos trámites. La dirección electrónica de dicho sistema es https://iris.acatlan.unam.mx y su usuario y contraseña son:
|
||||
|
||||
Usuario: ${usuariomail}
|
||||
Nombre de usuario para ingresar: ${usuariomail}
|
||||
|
||||
Contraseña: ${secreto}
|
||||
|
||||
@@ -155,32 +196,35 @@ Para el uso de dicho sistema el proceso es el siguiente:
|
||||
|
||||
5. Por su parte el alumno ingresará al sistema para subir escaneado su informe de actividades con firma y sello de su jefe inmediato y llenará un cuestionario de evaluación del programa de servicio social en el que participó.
|
||||
|
||||
6. Si todo está correcto el Departamento de servicio social validará el trámite de término del alumno y le notificará el tiempo aproximado en que puede pasar a recoger su carta de liberación de servicio social.
|
||||
6. Si todo está correcto el Departamento de servicio social validará el trámite de término del alumno y le notificará el tiempo aproximado en que se le enviará por correo su carta de liberación.
|
||||
|
||||
Otras consideraciones:
|
||||
|
||||
- Le pedimos su apoyo cargando las cartas de los alumnos en un periodo de 10 días hábiles posteriores a la fecha de inicio y término, ya que a su vez los alumnos tendrán otros 10 días hábiles para completar lo que les corresponde en cada etapa. Para todos los casos de este año que ya hayan iniciado su servicio social con anterioridad, le pedimos que antes del 15 de Mayo, quede registrado en nuestro sistema.
|
||||
- Le pedimos su apoyo cargando las cartas de los alumnos en un periodo de 10 días hábiles posteriores a la fecha de inicio y término, ya que a su vez los alumnos tendrán otros 10 días hábiles para completar lo que les corresponde en cada etapa.
|
||||
|
||||
- Para obtener los datos que el sistema le pide del alumno puede preguntárselos directamente, ya que las cartas de presentación sólo se emiten para instituciones externas.
|
||||
- Para obtener los datos que el sistema le pide del alumno puede preguntárselos directamente, ya que las cartas de presentación sólo se emiten para instituciones externas.
|
||||
|
||||
- Los profesores de carrera con proyectos de servicio social registrados no tendrán claves de acceso a este sistema, por lo que sus áreas de adscripción deberán encargarse de hacer los trámites de servicio social de sus alumnos.
|
||||
|
||||
- Finalmente, cabe mencionar que el nuevo procedimiento sólo aplica a los alumnos que inicien su servicio social en 2020, por lo que aquellos que ya habían hecho su trámite de inicio desde 2019, lo terminarán con el proceso anterior entregando su carta de termino original en las ventanillas de servicio social.
|
||||
|
||||
- De cualquier forma para atender dudas o comentarios al respecto, podrá comunicarse con el equipo del Departamento de Servicio Social:
|
||||
|
||||
Lic. Lourdes Ibarra Celorio
|
||||
56231686
|
||||
registross@acatlan.unam.mx
|
||||
tramites.ss@acatlan.unam.mx
|
||||
|
||||
Mtra. Adriana Roque del Angel
|
||||
Lic. Marcela Martínez Rangel
|
||||
56231600
|
||||
jefaturassbt@acatlan.unam.mx
|
||||
sesocial@acatlan.unam.mx.
|
||||
|
||||
Lic. Ivette Selene Hernández Rios
|
||||
56231600
|
||||
sesoprof@acatlan.unam.mx
|
||||
|
||||
Atentamente
|
||||
|
||||
Mtra. Adriana Roque del Angel
|
||||
Jefa del Departamento de Servicio Social y Bolsa de Trabajo.`,
|
||||
Lic. Ivette Selene Hernández Rios
|
||||
Jefa del Departamento de Servicio Social, Desarrollo Profesional e Inserción Laboral
|
||||
`,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -195,15 +239,14 @@ En cuanto cumplas con las 480 horas reglamentarias, tienes 15 días hábiles par
|
||||
|
||||
Por su parte el responsable del programa de servicio social deberá ingresar al mismo sistema para subir escaneada tu carta de término y debe responder el Cuestionario de desempeño del alumno. Para lo anterior, también la institución tiene 15 días hábiles a partir de que concluiste las 480 horas de servicio.
|
||||
|
||||
En cuanto el responsable de programa de servicio social y tú suban al sistema lo que les corresponde, el Departamento de Servicio Social revisará tus documentos y en caso de estar correctos validará tu trámite para realizar la liberación de este requisito. Recibirás una notificación por correo con el periodo de tiempo aproximado que debes esperar para acudir a recoger la copia de tu carta de liberación o bien, las indicaciones de los documentos que debes corregir para poder aceptar tu trámite de término.
|
||||
En cuanto el responsable de programa de servicio social y tú suban al sistema lo que les corresponde, el Departamento de Servicio Social revisará tus documentos y en caso de estar correctos validará tu trámite para realizar la liberación de este requisito. Recibirás una notificación por correo con el periodo de tiempo aproximado que debes esperar para recibir por correo electrónico tu carta de liberación o bien, las indicaciones de los documentos que debes corregir para poder aceptar tu trámite de término.
|
||||
|
||||
Por reglamento de la Universidad, si en máximo dos años a partir de la fecha de inicio de servicio social no se realiza el trámite de término mencionado anteriormente, debes tomar en cuenta que tu registro queda cancelado y deberás tramitarlo nuevamente en otro programa.
|
||||
|
||||
${dudas}
|
||||
${dudasAlumno}
|
||||
|
||||
Atentamente
|
||||
Departamento de Servicio Social y Bolsa de Trabajo
|
||||
FES Acatlán`,
|
||||
${atentamente}
|
||||
`,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -222,11 +265,9 @@ En cuanto usted y el alumno suban al sistema lo que les corresponde, el Departam
|
||||
|
||||
También se le ha informado al alumno que por reglamento de la Universidad, si en máximo dos años a partir de la fecha de inicio de servicio social no se realiza el trámite de término mencionado anteriormente, debe tomar en cuenta que su registro queda cancelado y deberá tramitarlo nuevamente en otro programa.
|
||||
|
||||
${dudas}
|
||||
${dudasResponsable}
|
||||
|
||||
Atentamente
|
||||
Departamento de Servicio Social y Bolsa de Trabajo
|
||||
FES Acatlán
|
||||
${atentamente}
|
||||
`,
|
||||
};
|
||||
};
|
||||
|
||||
+40
-35
@@ -1,53 +1,58 @@
|
||||
const moment = require('moment');
|
||||
const gmail = require('./gmail');
|
||||
const correos = require('./correos');
|
||||
const Servicio = require('../db/tablas/Servicio');
|
||||
const Usuario = require('../db/tablas/Usuario');
|
||||
const Programa = require('../db/tablas/Programa');
|
||||
const gmail = require('./gmail');
|
||||
const correos = require('./correos');
|
||||
const now = moment();
|
||||
|
||||
const diario = async () => {
|
||||
let mensaje = '';
|
||||
const now = moment();
|
||||
const servicios = await Servicio.findAll({
|
||||
return Servicio.findAll({
|
||||
where: { idStatus: 3 },
|
||||
include: [
|
||||
{ model: Usuario },
|
||||
{ model: Programa, include: [{ model: Usuario }] },
|
||||
],
|
||||
});
|
||||
}).then(async (servicios) => {
|
||||
let mensaje = '';
|
||||
|
||||
for (let i = 0; i < servicios.length; i++) {
|
||||
let fechaFin = moment(servicios[i].fechaFin);
|
||||
let fechaFinDate = fechaFin.dayOfYear();
|
||||
for (let i = 0; i < servicios.length; i++) {
|
||||
let fechaFin = moment(servicios[i].fechaFin);
|
||||
let fechaFinDate = fechaFin.dayOfYear();
|
||||
|
||||
if (fechaFin.year() > now.year())
|
||||
fechaFinDate += 365 * (fechaFin.year() - now.year());
|
||||
if (fechaFin.year() < now.year())
|
||||
fechaFinDate -= 365 * (now.year() - fechaFin.year());
|
||||
if (fechaFinDate - now.dayOfYear() === 7) {
|
||||
let correoAlumno = correos.avisoTerminoAlumno(
|
||||
servicios[i].Usuario.nombre
|
||||
);
|
||||
let correoResponsable = correos.avisoTerminoResponsable(
|
||||
servicios[i].Usuario.nombre
|
||||
);
|
||||
if (fechaFin.year() > now.year())
|
||||
fechaFinDate += 365 * (fechaFin.year() - now.year());
|
||||
if (fechaFin.year() < now.year())
|
||||
fechaFinDate -= 365 * (now.year() - fechaFin.year());
|
||||
if (fechaFinDate - now.dayOfYear() === 7) {
|
||||
let correoAlumno = correos.avisoTerminoAlumno(
|
||||
servicios[i].Usuario.nombre
|
||||
);
|
||||
let correoResponsable = correos.avisoTerminoResponsable(
|
||||
servicios[i].Usuario.nombre
|
||||
);
|
||||
|
||||
mensaje += `Se envio correo al alumno ${servicios[i].Usuario.usuario} con id ${servicios[i].Usuario.idUsuario} al correo ${servicios[i].correo} y al responsable ${servicios[i].Programa.Usuario.nombre} con id ${servicios[i].Programa.Usuario.idUsuario} y correo ${servicios[i].Programa.Usuario.usuario}\n`;
|
||||
await gmail(correoAlumno.subject, servicios[i].correo, correoAlumno.msj);
|
||||
await gmail(
|
||||
correoResponsable.subject,
|
||||
servicios[i].Programa.Usuario.usuario,
|
||||
correoResponsable.msj
|
||||
);
|
||||
} else if (fechaFinDate - now.dayOfYear() <= -1) {
|
||||
mensaje += `El servicio con id ${servicios[i].idServicio} del alumno ${servicios[i].Usuario.usuario} con id ${servicios[i].Usuario.idUsuario} paso al status 4\n`;
|
||||
await Servicio.update(
|
||||
{ idStatus: 4 },
|
||||
{ where: { idServicio: servicios[i].idServicio } }
|
||||
);
|
||||
mensaje += `Se envio correo al alumno ${servicios[i].Usuario.usuario} con id ${servicios[i].Usuario.idUsuario} al correo ${servicios[i].correo} y al responsable ${servicios[i].Programa.Usuario.nombre} con id ${servicios[i].Programa.Usuario.idUsuario} y correo ${servicios[i].Programa.Usuario.usuario}\n\n`;
|
||||
await gmail(
|
||||
correoAlumno.subject,
|
||||
servicios[i].correo,
|
||||
correoAlumno.msj
|
||||
);
|
||||
await gmail(
|
||||
correoResponsable.subject,
|
||||
servicios[i].Programa.Usuario.usuario,
|
||||
correoResponsable.msj
|
||||
);
|
||||
} else if (fechaFinDate - now.dayOfYear() <= -1) {
|
||||
mensaje += `El servicio con id ${servicios[i].idServicio} del alumno ${servicios[i].Usuario.usuario} con id ${servicios[i].Usuario.idUsuario} paso al status 4\n\n`;
|
||||
await Servicio.update(
|
||||
{ idStatus: 4 },
|
||||
{ where: { idServicio: servicios[i].idServicio } }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
await gmail('Reporte función diario', 'lemuel@acatlan.unam.mx', mensaje);
|
||||
return gmail('Reporte función diario', 'lemuel@acatlan.unam.mx', mensaje);
|
||||
});
|
||||
};
|
||||
|
||||
diario();
|
||||
|
||||
+183
-132
@@ -1,131 +1,181 @@
|
||||
require('../config/config');
|
||||
const fs = require('fs');
|
||||
const { google } = require('googleapis');
|
||||
const drive = google.drive('v3');
|
||||
const credenciales = JSON.parse(fs.readFileSync('./cred.json', 'utf8'));
|
||||
const jwtClient = new google.auth.JWT(
|
||||
credenciales.client_email,
|
||||
null,
|
||||
credenciales.private_key,
|
||||
['https://www.googleapis.com/auth/drive']
|
||||
);
|
||||
// const drive = google.drive('v3');
|
||||
// const credenciales = JSON.parse(fs.readFileSync('./cred.json', 'utf8'));
|
||||
// const jwtClient = new google.auth.JWT(
|
||||
// credenciales.client_email,
|
||||
// null,
|
||||
// credenciales.private_key,
|
||||
// ['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) => {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
// jwtClient.authorize((err, tokens) => {
|
||||
// if (err) reject('Error de autorización: ' + err);
|
||||
const authClient = await loadCredentials();
|
||||
const drive = google.drive({ version: 'v3', auth: authClient });
|
||||
|
||||
drive.files.list(
|
||||
{
|
||||
// auth: jwtClient,
|
||||
corpora: 'user',
|
||||
supportsTeamDrives: true,
|
||||
includeTeamDriveItems: true,
|
||||
spaces: 'drive',
|
||||
pageSize: 1000,
|
||||
pageToken,
|
||||
// fields: '*',
|
||||
orderBy: 'name',
|
||||
},
|
||||
(err, resp) => {
|
||||
console.log(resp);
|
||||
|
||||
if (err) reject('Ha habido un error en la petición: ' + err);
|
||||
resolve(resp.data);
|
||||
}
|
||||
);
|
||||
// });
|
||||
});
|
||||
};
|
||||
|
||||
// Borrar archivo
|
||||
const deleteFile = (fileId) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
jwtClient.authorize(async (err, tokens) => {
|
||||
if (err) reject(err);
|
||||
if (fileId === process.env.CARPETA)
|
||||
throw new Error('No se puede eliminar este archivo/carpeta.');
|
||||
return new Promise(async (resolve, reject) => {
|
||||
// jwtClient.authorize(async (err, tokens) => {
|
||||
// if (err) reject(err);
|
||||
const authClient = await loadCredentials();
|
||||
const drive = google.drive({ version: 'v3', auth: authClient });
|
||||
|
||||
drive.files.delete(
|
||||
{
|
||||
fileId,
|
||||
auth: jwtClient,
|
||||
},
|
||||
(err, resp) => {
|
||||
if (err) reject(err);
|
||||
resolve(resp);
|
||||
}
|
||||
);
|
||||
});
|
||||
drive.files.delete(
|
||||
{
|
||||
fileId,
|
||||
// auth: jwtClient,
|
||||
},
|
||||
(err, resp) => {
|
||||
if (err) reject(err);
|
||||
resolve(resp);
|
||||
}
|
||||
);
|
||||
// });
|
||||
});
|
||||
};
|
||||
|
||||
// SUBIR ARCHIVO
|
||||
const uploadFile = (path, name, mimeType, parent) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
jwtClient.authorize(function (err, tokens) {
|
||||
if (err) reject('Error de autorización: ' + err);
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const requestBody = {
|
||||
name,
|
||||
parents: [parent],
|
||||
};
|
||||
const media = {
|
||||
mimeType,
|
||||
body: fs.createReadStream(`${path}`),
|
||||
};
|
||||
|
||||
let requestBody = {
|
||||
name,
|
||||
parents: [parent],
|
||||
};
|
||||
let media = {
|
||||
mimeType: mimeType,
|
||||
body: fs.createReadStream(`${path}`),
|
||||
};
|
||||
// jwtClient.authorize(function (err, tokens) {
|
||||
// if (err) reject('Error de autorización: ' + err);
|
||||
const authClient = await loadCredentials();
|
||||
const drive = google.drive({ version: 'v3', auth: authClient });
|
||||
|
||||
drive.files.create(
|
||||
{
|
||||
media: media,
|
||||
fields: 'id',
|
||||
requestBody,
|
||||
auth: jwtClient,
|
||||
},
|
||||
(err, file) => {
|
||||
if (err) reject(err);
|
||||
fs.unlinkSync(path);
|
||||
resolve(file.data.id);
|
||||
}
|
||||
);
|
||||
});
|
||||
drive.files.create(
|
||||
{
|
||||
media,
|
||||
requestBody,
|
||||
fields: 'id',
|
||||
// auth: jwtClient,
|
||||
},
|
||||
(err, file) => {
|
||||
if (err) reject(err);
|
||||
fs.unlinkSync(path);
|
||||
resolve(file.data.id);
|
||||
}
|
||||
);
|
||||
// });
|
||||
});
|
||||
};
|
||||
|
||||
// CREAR CARPETA
|
||||
const mkDir = (name) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
jwtClient.authorize((err, tokens) => {
|
||||
if (err) reject('Error de autorización: ' + err);
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const authClient = await loadCredentials();
|
||||
const drive = google.drive({ version: 'v3', auth: authClient });
|
||||
const requestBody = {
|
||||
name,
|
||||
mimeType: 'application/vnd.google-apps.folder',
|
||||
parents: [process.env.CARPETA],
|
||||
};
|
||||
|
||||
let requestBody = {
|
||||
name,
|
||||
mimeType: 'application/vnd.google-apps.folder',
|
||||
parents: [process.env.CARPETA],
|
||||
};
|
||||
drive.files.create(
|
||||
{
|
||||
fields: 'id',
|
||||
auth: jwtClient,
|
||||
requestBody,
|
||||
},
|
||||
(err, res) => {
|
||||
if (err) reject(err);
|
||||
resolve(res.data.id);
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const list = (pageToken) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
jwtClient.authorize((err, tokens) => {
|
||||
if (err) reject('Error de autorización: ' + err);
|
||||
drive.files.list(
|
||||
{
|
||||
auth: jwtClient,
|
||||
corpora: 'user',
|
||||
supportsTeamDrives: true,
|
||||
includeTeamDriveItems: true,
|
||||
spaces: 'drive',
|
||||
pageSize: 1000,
|
||||
pageToken,
|
||||
// fields: '*',
|
||||
orderBy: 'name',
|
||||
},
|
||||
(err, resp) => {
|
||||
if (err) reject('Ha habido un error en la petición: ' + err);
|
||||
resolve(resp.data);
|
||||
}
|
||||
);
|
||||
});
|
||||
// jwtClient.authorize((err, tokens) => {
|
||||
// if (err) reject('Error de autorización: ' + err);
|
||||
drive.files.create(
|
||||
{
|
||||
fields: 'id',
|
||||
// auth: jwtClient,
|
||||
requestBody,
|
||||
},
|
||||
(err, res) => {
|
||||
console.log(err);
|
||||
console.log("variable res ");
|
||||
|
||||
console.log(res);
|
||||
|
||||
|
||||
if (err) reject(err);
|
||||
resolve(res.data.id);
|
||||
}
|
||||
);
|
||||
// });
|
||||
});
|
||||
};
|
||||
|
||||
// Update File
|
||||
const update = (fileId, addParents, removeParents) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
jwtClient.authorize((err, tokens) => {
|
||||
if (err) reject('Error de autorización: ' + err);
|
||||
drive.files.update(
|
||||
{ auth: jwtClient, fileId, addParents, removeParents },
|
||||
(err, resp) => {
|
||||
if (err) reject('Ha habido un error en la petición: ' + err);
|
||||
resolve(resp.data);
|
||||
}
|
||||
);
|
||||
});
|
||||
return new Promise(async (resolve, reject) => {
|
||||
// jwtClient.authorize((err, tokens) => {
|
||||
// if (err) reject('Error de autorización: ' + err);
|
||||
const authClient = await loadCredentials();
|
||||
const drive = google.drive({ version: 'v3', auth: authClient });
|
||||
|
||||
drive.files.update(
|
||||
{ auth: jwtClient, fileId, addParents, removeParents },
|
||||
(err, resp) => {
|
||||
if (err) reject('Ha habido un error en la petición: ' + err);
|
||||
resolve(resp.data);
|
||||
}
|
||||
);
|
||||
// });
|
||||
});
|
||||
};
|
||||
|
||||
@@ -133,50 +183,51 @@ const folder = async (numeroCuenta) => {
|
||||
let pageToken = '';
|
||||
|
||||
do {
|
||||
let response = await list(pageToken);
|
||||
let files = response.files;
|
||||
let res = await list(pageToken);
|
||||
|
||||
for (let i = 0; i < files.length; i++)
|
||||
for (let i = 0; i < res.files.length; i++)
|
||||
if (
|
||||
files[i].name === numeroCuenta &&
|
||||
files[i].mimeType === 'application/vnd.google-apps.folder'
|
||||
res.files[i].name === numeroCuenta &&
|
||||
res.files[i].mimeType === 'application/vnd.google-apps.folder'
|
||||
)
|
||||
return files[i].id;
|
||||
pageToken = '';
|
||||
if (response.nextPageToken) pageToken = response.nextPageToken;
|
||||
return res.files[i].id;
|
||||
pageToken = res.nextPageToken ? res.nextPageToken : '';
|
||||
} while (pageToken);
|
||||
return mkDir(numeroCuenta);
|
||||
};
|
||||
|
||||
const borrarTodo = () => {
|
||||
return list().then(async (res) => {
|
||||
console.log(res);
|
||||
// for (let i = 0; i < res.files.length; i++)
|
||||
// if (res.files[i].name !== 'Babyhelon') await deleteFile(res.files[i].id);
|
||||
});
|
||||
};
|
||||
// const borrarTodo = () => {
|
||||
// return list().then(async (res) => {
|
||||
// for (let i = 0; i < res.files.length; i++)
|
||||
// if (res.files[i].id !== process.env.CARPETA)
|
||||
// await deleteFile(res.files[i].id);
|
||||
// });
|
||||
// };
|
||||
|
||||
// borrarTodo();
|
||||
|
||||
const archivosFicheros = async () => {
|
||||
const findAll = async () => {
|
||||
const folders = [];
|
||||
const pdfs = [];
|
||||
let pageToken = '';
|
||||
const pdf = [];
|
||||
const carpetas = [];
|
||||
|
||||
do {
|
||||
let response = await list(pageToken);
|
||||
|
||||
console.log(response);
|
||||
if (response.nextPageToken) pageToken = response.nextPageToken;
|
||||
else pageToken = '';
|
||||
await list(pageToken).then((res) => {
|
||||
for (let i = 0; i < res.files.length; i++) {
|
||||
if (res.files[i].id !== process.env.CARPETA) {
|
||||
if (res.files[i].mimeType === 'application/vnd.google-apps.folder')
|
||||
folders.push(res.files[i].id);
|
||||
if (res.files[i].mimeType === 'application/pdf')
|
||||
pdfs.push(res.files[i].id);
|
||||
}
|
||||
}
|
||||
pageToken = res.nextPageToken ? res.nextPageToken : '';
|
||||
});
|
||||
} while (pageToken);
|
||||
|
||||
return { pdf, carpetas };
|
||||
return { folders, pdfs };
|
||||
};
|
||||
|
||||
// archivosFicheros();
|
||||
|
||||
module.exports = {
|
||||
folder,
|
||||
uploadFile,
|
||||
deleteFile,
|
||||
mkDir,
|
||||
};
|
||||
|
||||
@@ -1,28 +1,17 @@
|
||||
const bcrypt = require('bcrypt');
|
||||
const validar = require('./validar');
|
||||
require('../config/config');
|
||||
|
||||
const comparar = (password, dbPassword) => {
|
||||
let campo = 'password';
|
||||
|
||||
validar.noHay(password, campo);
|
||||
if (typeof password != 'string') validar.noValido(campo);
|
||||
if (!bcrypt.compareSync(password, dbPassword))
|
||||
throw new Error('Usuario o contraseña no validos.');
|
||||
if (!bcrypt.compareSync(password, dbPassword)) return false;
|
||||
return true;
|
||||
};
|
||||
|
||||
const encriptar = (password) => {
|
||||
let campo = 'password';
|
||||
|
||||
validar.noHay(password, campo);
|
||||
if (typeof password != 'string') validar.noValido(campo);
|
||||
return bcrypt.hashSync(password, Number(process.env.SALT_ROUNDS));
|
||||
};
|
||||
const encriptar = (password) =>
|
||||
bcrypt.hashSync(password, Number(process.env.SALT_ROUNDS));
|
||||
|
||||
const generarPassword = () => {
|
||||
let length = 8;
|
||||
let charset =
|
||||
const length = 8;
|
||||
const charset =
|
||||
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||
let password = '';
|
||||
|
||||
|
||||
+20
-11
@@ -1,17 +1,26 @@
|
||||
require('../config/config');
|
||||
require('../config/config'); // mantiene tu carga de variables
|
||||
const nodemailer = require('nodemailer');
|
||||
|
||||
const send = require('gmail-send')({
|
||||
user: process.env.GMAIL,
|
||||
pass: process.env.GMAILPASSWORD,
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: 'smtp.gmail.com', // o smtp‑relay.gmail.com (ver punto 2)
|
||||
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) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
send({ subject, to, text }, (error, result, fullResult) => {
|
||||
if (error) reject(error);
|
||||
resolve(result);
|
||||
});
|
||||
const gmail = (subject, to, text) =>
|
||||
transporter.sendMail({
|
||||
from: process.env.USER_GMAIL,
|
||||
to,
|
||||
subject,
|
||||
text,
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = gmail;
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ const moment = require('moment');
|
||||
|
||||
const crearDDMMAAAA = (date) => {
|
||||
const fechaMoment = moment(date);
|
||||
|
||||
// const fechaMoment = moment(new Date(date).toISOString());
|
||||
|
||||
let ddmmaaaa = '';
|
||||
|
||||
if (fechaMoment.isValid())
|
||||
|
||||
+322
-115
@@ -1,60 +1,27 @@
|
||||
// const fs = require('fs');
|
||||
const moment = require('moment');
|
||||
const validator = require('validator');
|
||||
const Servicio = require('../db/tablas/Servicio');
|
||||
|
||||
const noValido = (campo) => {
|
||||
throw new Error(`${campo} no es valido.`);
|
||||
};
|
||||
|
||||
const noHay = (variable, campo) => {
|
||||
if (!variable) throw new Error(`Falta ${campo}.`);
|
||||
};
|
||||
|
||||
const yaExiste = (campo) => {
|
||||
throw new Error(`${campo} ya se encuentra en uso.`);
|
||||
};
|
||||
|
||||
const validar = (texto, campo, length) => {
|
||||
noHay(texto, campo);
|
||||
if (typeof texto !== 'string' || (length && texto.length > length))
|
||||
noValido(campo);
|
||||
return texto;
|
||||
};
|
||||
|
||||
const validarId = (id) => {
|
||||
let campo = 'El id';
|
||||
|
||||
noHay(id, campo);
|
||||
if (typeof id === 'number') id = id.toString();
|
||||
if (typeof id !== 'string' || !validator.isNumeric(id, { no_symbols: true }))
|
||||
noValido(campo);
|
||||
return Number(id);
|
||||
};
|
||||
|
||||
const validarCorreo = (correo) => {
|
||||
let campo = 'El correo';
|
||||
|
||||
noHay(correo, campo);
|
||||
if (typeof correo !== 'string' || !validator.isEmail(correo)) noValido(campo);
|
||||
return correo;
|
||||
};
|
||||
|
||||
const caracteresEspeciales = (char) => {
|
||||
// Caractéres especiales permitidos en una string
|
||||
const caracterEspecial = (char) => {
|
||||
const charset = [
|
||||
' ',
|
||||
'.',
|
||||
'-',
|
||||
',',
|
||||
'/',
|
||||
'#',
|
||||
'?',
|
||||
'¿',
|
||||
':',
|
||||
';',
|
||||
'?',
|
||||
'¿',
|
||||
'!',
|
||||
'¡',
|
||||
'(',
|
||||
')',
|
||||
'"',
|
||||
"'",
|
||||
'-',
|
||||
'_',
|
||||
'/',
|
||||
'#',
|
||||
'%',
|
||||
'\n',
|
||||
];
|
||||
@@ -63,107 +30,347 @@ const caracteresEspeciales = (char) => {
|
||||
return false;
|
||||
};
|
||||
|
||||
const validarTexto = (texto, campo, length) => {
|
||||
noHay(texto, campo);
|
||||
if (typeof texto !== 'string' || texto.length > length) noValido(campo);
|
||||
const yaExiste = (campo, m) => {
|
||||
throw new Error(`Ya se encuentra en uso ${m ? 'el' : 'la'} ${campo}.`);
|
||||
};
|
||||
|
||||
const noValido = (campo, m, razon) => {
|
||||
console.log(m);
|
||||
throw new Error(
|
||||
`${m ? 'El' : 'La'} ${campo} no es valid${m ? 'o' : 'a'}, ${razon}.`
|
||||
);
|
||||
};
|
||||
|
||||
/*
|
||||
Valida que la variable contenga un valor, de lo contrario saca un error.
|
||||
*/
|
||||
const noHay = (variable, campo, m) => {
|
||||
if (!variable) throw new Error(`No se mando ${m ? 'el' : 'la'} ${campo}.`);
|
||||
};
|
||||
|
||||
/*
|
||||
Valida que la variable sea una string y, si se necesita, que mida igual
|
||||
o menor que una longitud determinada.
|
||||
*/
|
||||
const validacionBasicaStr = (texto, campo, m, length) => {
|
||||
noHay(texto, campo, m);
|
||||
if (typeof texto !== 'string') noValido(campo, m, 'no se mando una string');
|
||||
if (length && texto.length > length)
|
||||
noValido(campo, m, 'tiene más carecteres de lo permitido');
|
||||
return texto;
|
||||
};
|
||||
|
||||
/*
|
||||
Valida que la variable sea un numero entero, ya sea que recibe una string o
|
||||
un number. Usualmente se usa para validar ids.
|
||||
*/
|
||||
const validarNumeroEntero = (numero, campo, m = true) => {
|
||||
noHay(numero, campo, m);
|
||||
if (typeof numero === 'number') numero = numero.toString();
|
||||
if (typeof numero !== 'string')
|
||||
noValido(campo, m, 'no se mando una string o un number');
|
||||
if (!validator.isNumeric(numero, { no_symbols: true }))
|
||||
noValido(campo, m, 'no es un número entero valido');
|
||||
return Number(numero);
|
||||
};
|
||||
|
||||
/*
|
||||
Valida que la stirng mandada sea un correo valido.
|
||||
*/
|
||||
const validarCorreo = (correo, campo = 'correo', m = true, length) => {
|
||||
validacionBasicaStr(correo, campo, m, length);
|
||||
if (!validator.isEmail(correo)) noValido(campo, m, 'no es un correo válido');
|
||||
return correo;
|
||||
};
|
||||
|
||||
/*
|
||||
Valida que la stirng mandada sea solo caracteres del abcdario.
|
||||
Usualmente se usa para validar nombres, apellidos, etc.
|
||||
*/
|
||||
const validarTexto = (texto, campo, m, length) => {
|
||||
validacionBasicaStr(texto, campo, m, length);
|
||||
for (let i = 0; i < texto.length; i++)
|
||||
if (
|
||||
!validator.isAlpha(texto[i], 'es-ES') &&
|
||||
texto[i] != ' ' &&
|
||||
texto[i] != '.'
|
||||
)
|
||||
noValido(campo, m, 'contiene caracteres no validos');
|
||||
return texto;
|
||||
};
|
||||
|
||||
/*
|
||||
Lo mismo que el de arriba pero este permite números y
|
||||
caracteres especiales.
|
||||
*/
|
||||
const validarAlfanumerico = (texto, campo, m, length) => {
|
||||
validacionBasicaStr(texto, campo, m, length);
|
||||
for (let i = 0; i < texto.length; i++) {
|
||||
if (caracteresEspeciales(texto[i])) continue;
|
||||
if (!validator.isAlpha(texto[i], 'es-ES')) noValido(campo);
|
||||
if (caracterEspecial(texto[i])) continue;
|
||||
if (!validator.isAlphanumeric(texto[i], 'es-ES'))
|
||||
noValido(campo, m, 'contiene caracteres no validos');
|
||||
}
|
||||
return texto;
|
||||
};
|
||||
|
||||
const validarAlfanumerico = (texto, campo, length) => {
|
||||
noHay(texto, campo);
|
||||
if (typeof texto !== 'string' || texto.length > length) noValido(campo);
|
||||
for (let i = 0; i < texto.length; i++) {
|
||||
if (caracteresEspeciales(texto[i])) continue;
|
||||
if (!validator.isAlphanumeric(texto[i], 'es-ES')) noValido(campo);
|
||||
}
|
||||
return texto;
|
||||
};
|
||||
|
||||
const validarNumeroCuenta = (numeroCuenta) => {
|
||||
let campo = 'El numero de cuenta';
|
||||
|
||||
noHay(numeroCuenta, campo);
|
||||
if (
|
||||
typeof numeroCuenta !== 'string' ||
|
||||
!validator.isNumeric(numeroCuenta, { no_symbols: true }) ||
|
||||
numeroCuenta.length > 9
|
||||
)
|
||||
noValido(campo);
|
||||
/*
|
||||
Valida que la string sea un número menor a 9 dígitos.
|
||||
*/
|
||||
const validarNumeroCuenta = (
|
||||
numeroCuenta,
|
||||
campo = 'numero de cuenta',
|
||||
m = true
|
||||
) => {
|
||||
validacionBasicaStr(numeroCuenta, campo, m, 9);
|
||||
if (!validator.isNumeric(numeroCuenta, { no_symbols: true }))
|
||||
noValido(campo, m, 'tiene caracteres que no son números');
|
||||
return numeroCuenta;
|
||||
};
|
||||
|
||||
const validarFecha = (fecha) => {
|
||||
let campo = 'La fecha';
|
||||
/*
|
||||
Valida que la variable sea una fecha moment valida.
|
||||
*/
|
||||
const validarFecha = (fecha, campo, m) => {
|
||||
let fechaMoment = moment(fecha);
|
||||
|
||||
noHay(fecha, campo);
|
||||
if (!fechaMoment.isValid()) noValido(campo);
|
||||
noHay(fecha, campo, m);
|
||||
if (!fechaMoment.isValid()) noValido(campo, m, 'no es una fecha válida');
|
||||
return fechaMoment;
|
||||
};
|
||||
|
||||
const validarNumero = (numero, makeNumber = false, length) => {
|
||||
let campo = 'El numero';
|
||||
|
||||
noHay(numero, campo);
|
||||
if (
|
||||
typeof numero !== 'string' ||
|
||||
!validator.isNumeric(numero, { no_symbols: true }) ||
|
||||
(length && numero.length > length)
|
||||
)
|
||||
noValido(campo);
|
||||
/*
|
||||
Valida que una string contenga solo números
|
||||
*/
|
||||
const validarNumero = (
|
||||
numero,
|
||||
campo,
|
||||
m,
|
||||
length,
|
||||
no_symbols = true,
|
||||
makeNumber = false
|
||||
) => {
|
||||
validacionBasicaStr(numero, campo, m, length);
|
||||
if (!validator.isNumeric(numero, { no_symbols }))
|
||||
noValido(campo, m, 'tiene caracteres que no son números');
|
||||
if (makeNumber) return Number(numero);
|
||||
return numero;
|
||||
};
|
||||
|
||||
const validarPreTermino = (idServicio) => {
|
||||
return Servicio.findOne({ where: { idServicio } })
|
||||
.then((res) => {
|
||||
if (
|
||||
res.idCuestionarioPrograma &&
|
||||
res.idCuestionarioAlumno &&
|
||||
res.cartaTermino &&
|
||||
res.informeGlobal
|
||||
)
|
||||
return Servicio.update({ idStatus: 5 }, { where: { idServicio } });
|
||||
return false;
|
||||
})
|
||||
.then((res) => {
|
||||
if (res)
|
||||
return 'Este Servicio Social paso a Termino, espera a que COESI autorice tu liberación.';
|
||||
return '';
|
||||
});
|
||||
};
|
||||
|
||||
const validarAccesibilidad = (usuariosValidos = [], idTipoUsuario) => {
|
||||
for (let i = 0; i < usuariosValidos.length; i++)
|
||||
if (idTipoUsuario === usuariosValidos[i]) return;
|
||||
throw new Error('Este usuario no tiene permitido usar esta linea de la API.');
|
||||
};
|
||||
// const validarAccesibilidad = (usuariosValidos = [], idTipoUsuario) => {
|
||||
// for (let i = 0; i < usuariosValidos.length; i++)
|
||||
// if (idTipoUsuario === usuariosValidos[i]) return;
|
||||
// throw new Error('Este usuario no tiene permitido usar esta linea de la API.');
|
||||
// };
|
||||
|
||||
/*
|
||||
Te dice si un objeto esta vacio o no.
|
||||
*/
|
||||
const validarObjetoVacio = (obj) => {
|
||||
for (let key in obj) {
|
||||
if (obj.hasOwnProperty(key)) return false;
|
||||
}
|
||||
for (let key in obj) if (obj.hasOwnProperty(key)) return false;
|
||||
return true;
|
||||
};
|
||||
|
||||
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 } })
|
||||
.then((res) => {
|
||||
|
||||
console.log("validando pre termino", res);
|
||||
|
||||
|
||||
if (
|
||||
(res.idCuestionarioPrograma || res.idCuestionarioPrograma2) &&
|
||||
(res.idCuestionarioAlumno || res.idCuestionarioAlumno2) &&
|
||||
res.cartaTermino &&
|
||||
res.informeGlobal
|
||||
) return Servicio.update({ idStatus: 5 }, { where: { idServicio } });
|
||||
return false;
|
||||
})
|
||||
.then((res) =>
|
||||
res
|
||||
? 'Este Servicio Social paso a Termino, espera a que COESI autorice tu liberación.'
|
||||
: ''
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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 = {
|
||||
validar,
|
||||
noValido,
|
||||
yaExiste,
|
||||
noValido,
|
||||
noHay,
|
||||
validacionBasicaStr,
|
||||
validarNumeroEntero,
|
||||
validarCorreo,
|
||||
validarId,
|
||||
validarTexto,
|
||||
validarAlfanumerico,
|
||||
validarNumeroCuenta,
|
||||
validarFecha,
|
||||
validarNumero,
|
||||
validarPreTermino,
|
||||
validarAccesibilidad,
|
||||
validarObjetoVacio,
|
||||
validarPreTermino,
|
||||
|
||||
validarCuestionarioAlumno2,
|
||||
validarCuestionarioPrograma2
|
||||
|
||||
};
|
||||
|
||||
@@ -2,11 +2,13 @@ require('../config/config');
|
||||
const jwt = require('jsonwebtoken');
|
||||
|
||||
const verificaToken = (req, res, next) => {
|
||||
|
||||
let token = req.headers.token;
|
||||
|
||||
|
||||
if (!token)
|
||||
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) => {
|
||||
if (err) {
|
||||
@@ -23,6 +25,10 @@ const verificaToken = (req, res, next) => {
|
||||
req.decoded = decoded;
|
||||
next();
|
||||
});
|
||||
|
||||
|
||||
|
||||
// next() // solo esta linea si se estan haciendo pruebas
|
||||
};
|
||||
|
||||
const crearToken = (info) => {
|
||||
|
||||
@@ -15,7 +15,7 @@ const update = require(`${controllerPath}/update`);
|
||||
// POST
|
||||
app.post(
|
||||
`${route}/nuevo`,
|
||||
// verificaToken,
|
||||
verificaToken,
|
||||
upload.single('archivos'),
|
||||
(req, res) => {
|
||||
return nuevo(JSON.parse(req.body.alumno), req.file.filename)
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
const { verificaToken } = require('../middleware/autentificacion');
|
||||
// const { verificaToken } = require('../middleware/autentificacion');
|
||||
const route = '/cuestionario_alumno';
|
||||
const controllerPath = '../controller/CuestionarioAlumno';
|
||||
|
||||
const get = require(`${controllerPath}/get`);
|
||||
const nuevo = require(`${controllerPath}/nuevo`);
|
||||
|
||||
// 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)
|
||||
.then((data) => {
|
||||
res.status(200).json(data);
|
||||
@@ -18,7 +23,10 @@ app.post(`${route}`, verificaToken, (req, res) => {
|
||||
});
|
||||
|
||||
// GET
|
||||
app.get(`${route}`, verificaToken, (req, res) => {
|
||||
app.get(`${route}`,
|
||||
// verificaToken,
|
||||
|
||||
(req, res) => {
|
||||
return get(req.query)
|
||||
.then((data) => {
|
||||
res.download(data);
|
||||
|
||||
@@ -3,11 +3,14 @@ const app = express();
|
||||
const { verificaToken } = require('../middleware/autentificacion');
|
||||
const route = '/cuestionario_programa';
|
||||
const controllerPath = '../controller/CuestionarioPrograma';
|
||||
|
||||
const get = require(`${controllerPath}/get`);
|
||||
const nuevo = require(`${controllerPath}/nuevo`);
|
||||
|
||||
// POST
|
||||
app.post(`${route}`, verificaToken, (req, res) => {
|
||||
app.post(`${route}`,
|
||||
verificaToken,
|
||||
(req, res) => {
|
||||
return nuevo(req.body)
|
||||
.then((data) => {
|
||||
res.status(200).json(data);
|
||||
@@ -18,7 +21,9 @@ app.post(`${route}`, verificaToken, (req, res) => {
|
||||
});
|
||||
|
||||
// GET
|
||||
app.get(`${route}`, verificaToken, (req, res) => {
|
||||
app.get(`${route}`,
|
||||
verificaToken,
|
||||
(req, res) => {
|
||||
return get(req.query)
|
||||
.then((data) => {
|
||||
res.download(data);
|
||||
|
||||
@@ -13,7 +13,7 @@ const reasignarProgramas = require(`${controllerPath}/reasignarProgramas`);
|
||||
// POST
|
||||
app.post(
|
||||
`${route}/carga_masiva`,
|
||||
// verificaToken,
|
||||
verificaToken,
|
||||
upload.single('csv'),
|
||||
(req, res) => {
|
||||
if (req.file) {
|
||||
|
||||
@@ -28,7 +28,7 @@ const gustavoBazPrada = require(`${controllerPath}/gustavoBazPrada`);
|
||||
// POST
|
||||
app.post(
|
||||
`${route}/nuevo`,
|
||||
// verificaToken,
|
||||
verificaToken,
|
||||
upload.single('cartaAceptacion'),
|
||||
(req, res) => {
|
||||
return nuevo(JSON.parse(req.body.alumno), req.file.filename)
|
||||
@@ -116,7 +116,7 @@ app.put(`${route}/cancelar`, verificaToken, (req, res) => {
|
||||
|
||||
app.put(
|
||||
`${route}/carta_aceptacion`,
|
||||
// verificaToken,
|
||||
verificaToken,
|
||||
upload.single('cartaAceptacion'),
|
||||
(req, res) => {
|
||||
return cartaAceptacion(JSON.parse(req.body.data), req.file.filename)
|
||||
@@ -132,7 +132,7 @@ app.put(
|
||||
|
||||
app.put(
|
||||
`${route}/carta_termino`,
|
||||
// verificaToken,
|
||||
verificaToken,
|
||||
upload.single('cartaTermino'),
|
||||
(req, res) => {
|
||||
return cartaTermino(JSON.parse(req.body.data), req.file.filename)
|
||||
@@ -148,7 +148,7 @@ app.put(
|
||||
|
||||
app.put(
|
||||
`${route}/informe_global`,
|
||||
// verificaToken,
|
||||
verificaToken,
|
||||
upload.single('informeGlobal'),
|
||||
(req, res) => {
|
||||
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) => {
|
||||
return registroValidado(req.body)
|
||||
.then((data) => {
|
||||
console.log('golasdf');
|
||||
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
|
||||
@@ -5,6 +5,8 @@ const route = '/status';
|
||||
const get = require('../controller/Status/get');
|
||||
|
||||
app.get(`${route}`, verificaToken, (req, res) => {
|
||||
console.log("status");
|
||||
|
||||
return get()
|
||||
.then((data) => {
|
||||
res.status(200).json(data);
|
||||
|
||||
@@ -5,6 +5,7 @@ const route = '/usuario';
|
||||
const controllerPath = '../controller/Usuario';
|
||||
const escolares = require(`${controllerPath}/escolares`);
|
||||
const login = require(`${controllerPath}/login`);
|
||||
const newAdmin = require(`${controllerPath}/newUser`);
|
||||
const newPasswordAlumno = require(`${controllerPath}/newPasswordAlumno`);
|
||||
const newPasswordResponsable = require(`${controllerPath}/newPasswordResponsable`);
|
||||
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
|
||||
app.get(`${route}/escolares`, verificaToken, (req, res) => {
|
||||
return escolares(req.query)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
@@ -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();
|
||||
@@ -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
@@ -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
@@ -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`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user