2 Commits

29 changed files with 2212 additions and 4041 deletions
-25
View File
@@ -1,25 +0,0 @@
# Base image
FROM node:16-alpine
# Install build tools and Python
RUN apk add --no-cache python3 make g++ && \
python3 -m ensurepip && \
pip3 install --no-cache --upgrade pip
# Set working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Expose the port the app runs on
EXPOSE 3000
# Command to run the application
CMD ["npm", "run", "dev"]
-18
View File
@@ -1,18 +0,0 @@
{
"name": "Node.js API Dev Container",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"forwardPorts": [3000],
"settings": {
"terminal.integrated.defaultProfile.linux": "bash"
},
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
],
"postCreateCommand": "npm install",
"remoteUser": "node"
}
-37
View File
@@ -1,37 +0,0 @@
-- 1) Insertar un par de servicios
--INSERT INTO servicio VALUES ('094123123123','ferelena27@gmail.com','5538836200','Calle D #43 Colonia Modelo, Naucalpan de Juárez, Edo Mex.','2020-01-28 00:00:00','2020-07-28 00:00:00','1996-06-27 00:00:00','1zAAbHd2Gn8E7JougyynxHVLFJCHYM4U7','1ygjJyezG88X6qd-wV3i7PMDfW7yDGAbJ','1qzgUwhXqCRXPiYd0w8TADWB2Ja-0Geqy','1i-mmx-hlOVcdYHxoNM8ym96pwL2YQKxP','servicio y asesoría de cómputo','Lic. Araceli Pérez Palma',1,'2020-03-04 19:25:19','2021-04-26 19:21:57',2990,1,6,28,872,835,'2021-04-26 19:21:56');
--INSERT INTO servicio VALUES ('091234123123','ferelena27@gmail.com','5538836200','Calle D #43 Colonia Modelo, Naucalpan de Juárez, Edo Mex.','2020-01-28 00:00:00','2020-07-28 00:00:00','1996-06-27 00:00:00','1zAAbHd2Gn8E7JougyynxHVLFJCHYM4U7','1ygjJyezG88X6qd-wV3i7PMDfW7yDGAbJ','1qzgUwhXqCRXPiYd0w8TADWB2Ja-0Geqy','1i-mmx-hlOVcdYHxoNM8ym96pwL2YQKxP','servicio y asesoría de cómputo','Lic. Araceli Pérez Palma',1,'2020-03-04 19:25:19','2021-04-26 19:21:57',2990,1,6,28,872,835,'2021-04-26 19:21:56');
-- 2) Insertar cuestionarios, cada uno asociado a un servicio
INSERT INTO Cuestionario (
idServicio, version, titulo, `desc`, dirigidoA, createdAt
) VALUES
(1, 'v1.0', 'Cuestionario Inicial', 'Descripción breve', 'Alumnos', NOW()),
(2, 'v2.0', 'Cuestionario Avanzado', 'Otro cuestionario', 'Programas', '2025-01-23 10:25:00');
-- 3) Insertar en cuestionario_alumno_2
INSERT INTO cuestionario_alumno_2 (
idCuestionario,
createdAt,
p12_A_1,
p12_A_2,
p12_A_3,
p12_A_4,
p12_B_1,
p12_B_2
) VALUES
(1, NOW(), 'respuesta1', 'respuesta2', 'respuesta3', 'respuesta4', 'respuesta5', 'respuesta6'),
(1, '2025-01-23 11:00:00', 'respA', 'respB', 'respC', 'respD', 'respE', 'respF');
-- 4) Insertar en cuestionario_programa_2
INSERT INTO cuestionario_programa_2 (
idCuestionario,
createdAt,
p3_A_1,
p3_A_2,
p3_A_3,
p3_A_4,
p3_B_1
) VALUES
(2, NOW(), 'respuesta1', 'respuesta2', 'respuesta3', 'respuesta4', 'respuesta5'),
(2, '2025-01-23 12:15:00', 'respX', 'respY', 'respZ', 'respW', 'respQ');
+2123 -1213
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
-494
View File
@@ -1,494 +0,0 @@
-- 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 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 */;
/*!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 */;
/*!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 */;
/*!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 */;
/*!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
/* CREATE TABLE `servicio` (
`idServicio` INT PRIMARY KEY
); */
DROP TABLE IF EXISTS `Cuestionario`;
CREATE TABLE `Cuestionario` (
`idCuestionario` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
`idCuestionarioAlumno` INT, -- Agregado para relación con alumnos
`idCuestionarioPrograma` INT, -- Agregado para relación con programas
`idCuestionarioAlumno1` INT, -- Agregado para relación con alumnos
`idCuestionarioPrograma1` INT, -- Agregado para relación con programas
`idServicio` INT,
`version` VARCHAR(50),
`titulo` VARCHAR(50),
`desc` VARCHAR(50),
`dirigidoA` VARCHAR(50),
`createdAt` DATETIME
);
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(50),
`p12_A_2` VARCHAR(50),
`p12_A_3` VARCHAR(50),
`p12_A_4` VARCHAR(50),
`p12_B_1` VARCHAR(50),
`p12_B_2` VARCHAR(50),
`p12_B_3` VARCHAR(50),
`p12_B_4` VARCHAR(50),
`p12_C_1` VARCHAR(50),
`p12_C_2` VARCHAR(50),
`p12_C_3` VARCHAR(50),
`p12_C_4` VARCHAR(50),
`p10_1` VARCHAR(50),
`p10_2` VARCHAR(50),
`p10_3` VARCHAR(50),
`p11_1` VARCHAR(50),
`p11_2` VARCHAR(50),
`p11_3` VARCHAR(50),
`p11_4` VARCHAR(50),
`p17_1` VARCHAR(50),
`p17_2` VARCHAR(50),
`p17_3` VARCHAR(50),
`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` VARCHAR(150),
`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)
);
-- Relaciones corregidas
ALTER TABLE `Cuestionario`
ADD FOREIGN KEY (`idServicio`) REFERENCES `servicio` (`idServicio`);
ALTER TABLE `Cuestionario`
ADD FOREIGN KEY (`idCuestionarioAlumno`) REFERENCES `cuestionario_alumno_2` (`idCuestionarioAlumno2`);
ALTER TABLE `Cuestionario`
ADD FOREIGN KEY (`idCuestionarioPrograma`) REFERENCES `cuestionario_programa_2` (`idCuestionarioPrograma2`);
ALTER TABLE `Cuestionario`
ADD FOREIGN KEY (`idCuestionarioAlumno1`) REFERENCES `cuestionario_alumno` (`idCuestionarioAlumno`);
ALTER TABLE `Cuestionario`
ADD FOREIGN KEY (`idCuestionarioPrograma1`) REFERENCES `cuestionario_programa` (`idCuestionarioPrograma`);
-13
View File
@@ -1,8 +1,6 @@
require('./config');
const { Sequelize } = require('sequelize');
const sequelize = new Sequelize(
process.env.DB,
process.env.USERDB,
@@ -18,15 +16,4 @@ const sequelize = new Sequelize(
}
);
(async () => {
try {
await sequelize.authenticate();
console.log('Conexión exitosa con la Base de Datos');
} catch (error) {
console.error('No se pudo conectar a la BD:', error);
}
})();
module.exports = sequelize;
+3 -3
View File
@@ -1,5 +1,5 @@
const helperPath = '../../helper';
// const drive = require(`${helperPath}/drive`);
const drive = require(`${helperPath}/drive`);
const validar = require(`${helperPath}/validar`);
const dbPath = '../../db/tablas';
const Carrera = require(`${dbPath}/Carrera`);
@@ -63,14 +63,14 @@ const nuevo = async (body, file) => {
where: { idUsuario },
});
})
/* .then(async (res) => {
.then(async (res) => {
if (res) throw new Error('Este alumno ya tienen un Caso Especial.');
return drive.folder(numeroCuenta);
})
.then((res) => {
carpeta = res;
return drive.uploadFile(path, `archivos.zip`, 'application/zip', carpeta);
}) */
})
.then((res) =>
CasoEspecial.create({
idUsuario,
@@ -1,147 +0,0 @@
const { convertArrayToCSV } = require('convert-array-to-csv');
const { Op } = require('sequelize');
const helperPath = '../../helper';
const helper = require(`${helperPath}/helper`);
const { validarNumero } = require(`${helperPath}/validar`);
const dbPath = '../../db/tablas';
const CuestionarioAlumno2 = require(`${dbPath}/CuestionarioAlumno2`);
const Programa = require(`${dbPath}/Programa`);
const Servicio = require(`${dbPath}/Servicio`);
const Usuario = require(`${dbPath}/Usuario`);
const Carrera = require(`${dbPath}/Carrera`);
const get = async (body) => {
const year = validarNumero(body.year, 'año', true, 4);
const path = `server/uploads/${year}_cuestionario_alumno.csv`;
const data = [];
console.log(year);
/*
return Servicio.findAll({
include: [
{
model: CuestionarioAlumno2,
where: { idCuestionarioAlumno: { [Op.not]: null } },
},
{ model: Programa, where: { clavePrograma: { [Op.like]: `${year}%` } } },
{ model: Usuario },
{ model: Carrera },
],
order: [['createdAt']],
})
*/
/* return CuestionarioAlumno2.findAll({
where: {
idCuestionarioAlumno2: {
[Op.not]: null,
},
},
// order: [['createdAt', 'ASC']], // Descomentar si se requiere ordenamiento
})
.then(async (res) => {
console.log("segunda parte",res);
for (let i = 0; i < res.length; i++)
data.push({ ...res})
data.push({
idServicio: res[i].idServicio,
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,
servicioMedico: res[i].CuestionarioAlumno.servicioMedico,
p1: res[i].CuestionarioAlumno.p1,
p2: res[i].CuestionarioAlumno.p2,
p3: res[i].CuestionarioAlumno.p3,
p4: res[i].CuestionarioAlumno.p4,
p5: res[i].CuestionarioAlumno.p5,
p6: res[i].CuestionarioAlumno.p6,
p7: res[i].CuestionarioAlumno.p7,
p8: res[i].CuestionarioAlumno.p8,
p9: res[i].CuestionarioAlumno.p9,
p10: res[i].CuestionarioAlumno.p10,
p11: res[i].CuestionarioAlumno.p11,
p12: res[i].CuestionarioAlumno.p12,
p13: res[i].CuestionarioAlumno.p13,
p14: res[i].CuestionarioAlumno.p14,
p15: res[i].CuestionarioAlumno.p15,
p16: res[i].CuestionarioAlumno.p16,
p17: res[i].CuestionarioAlumno.p17,
p18: res[i].CuestionarioAlumno.p18,
p19: res[i].CuestionarioAlumno.p19,
p20: res[i].CuestionarioAlumno.p20,
p21: res[i].CuestionarioAlumno.p21,
p22: res[i].CuestionarioAlumno.p22,
p23: res[i].CuestionarioAlumno.p23,
p24: res[i].CuestionarioAlumno.p24,
p25: res[i].CuestionarioAlumno.p25,
p26: res[i].CuestionarioAlumno.p26,
p27: res[i].CuestionarioAlumno.p27,
p28: res[i].CuestionarioAlumno.p28,
p29: res[i].CuestionarioAlumno.p29,
p30: res[i].CuestionarioAlumno.p30,
createdAt: res[i].CuestionarioAlumno.createdAt,
});
await helper.eliminarArchivo(path).catch((err) => {
console.log(err);
});
return helper.crearArchivo(path, convertArrayToCSV(data));
})
.then((res) => path);
}; */
return CuestionarioAlumno2.findAll({
where: {
idCuestionarioAlumno2: {
[Op.not]: null,
},
},
})
.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;
@@ -1,246 +0,0 @@
const validar = require('../../helper/validar');
const dbPath = '../../db/tablas';
const CuestionarioAlumno = require(`${dbPath}/CuestionarioAlumno`);
const CuestionarioAlumno2 = require(`${dbPath}/CuestionarioAlumno2`);
const Cuestionario = require(`${dbPath}/Cuestionario`);
const Servicio = require(`${dbPath}/Servicio`);
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.idCuestionarioAlumno)
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, idCuestionario: cuestionarioRegistro.idCuestionario } );
let respuestasRegistradas = await CuestionarioAlumno2.create({ ...body, idCuestionario: cuestionarioRegistro.idCuestionario });
console.log('despues de registrar cuestionario', respuestasRegistradas);
console.log('cuestionario registrado', cuestionarioRegistro);
return cuestionarioRegistro;
})
.then((res) => ({
message: `Se guardaron tus respuestas correctamente. ${res}`,
}));
};
const convertirSTR = () => {
for (let i = 0; i < body.p3.length; i++) {
p3 += body.p3[i];
if (i < body.p3.length - 1) p3 += ',';
}
for (let i = 0; i < body.p5.length; i++) {
p5 += body.p5[i];
if (i < body.p5.length - 1) p5 += ',';
}
for (let i = 0; i < body.p8.length; i++) {
p8 += body.p8[i];
if (i < body.p8.length - 1) p8 += ',';
}
for (let i = 0; i < body.p14.length; i++) {
p14 += body.p14[i];
if (i < body.p14.length - 1) p14 += ',';
}
for (let i = 0; i < body.p15.length; i++) {
p15 += body.p15[i];
if (i < body.p15.length - 1) p15 += ',';
}
for (let i = 0; i < body.p17.length; i++) {
p17 += body.p17[i];
if (i < body.p17.length - 1) p17 += ',';
}
for (let i = 0; i < body.p21.length; i++) {
p21 += body.p21[i];
if (i < body.p21.length - 1) p21 += ',';
}
for (let i = 0; i < body.p22.length; i++) {
p22 += body.p22[i];
if (i < body.p22.length - 1) p22 += ',';
}
for (let i = 0; i < body.p23.length; i++) {
p23 += body.p23[i];
if (i < body.p23.length - 1) p23 += ',';
}
for (let i = 0; i < body.p24.length; i++) {
p24 += body.p24[i];
if (i < body.p24.length - 1) p24 += ',';
}
};
module.exports = nuevo;
/*
<!-- respuestas de cuestionario formulario2
todas las preguntas se guardan correctamente
{
"p3_A_1": "Deficiente",
"p3_A_2": "Deficiente",
"p3_A_3": "Deficiente",
"p3_A_4": "Deficiente",
"p3_B_1": "Básico",
"p3_B_2": "Básico",
"p3_B_3": "Básico",
"p3_B_4": "Básico",
"p3_C_1": "Intermedio",
"p3_C_2": "Intermedio",
"p3_C_3": "Intermedio",
"p3_C_4": "Intermedio",
"p3_C_5": "Intermedio",
"p3_D_1": "Destacado",
"p3_D_2": "Destacado",
"p3_D_3": "Destacado",
"p3_D_4": "Destacado",
"p3_D_5": "Destacado",
"p3_E_1": "Deficiente",
"p1": "respuesta1",
"p2": "Excelente",
"p4": "respuesta4",
"p5": "Sí",
"p6": "respuesta 6"
}
-->
<!-- respuestas de cuestionario formulario alumno
{
"p1": [
"Dependencia de la UNAM",
"Asesoría académica",
"Oportunidad de desarrollo de tesis"
],
"p12_A_1": "Deficiente",
"p12_A_2": "Deficiente",
"p12_A_3": "Deficiente",
"p12_A_4": "Deficiente",
"p12_B_1": "Básico",
"p12_B_2": "Básico",
"p12_B_3": "Básico",
"p12_B_4": "Básico",
"p12_C_1": "Intermedio",
"p12_C_2": "Intermedio",
"p12_C_3": "Intermedio",
"p12_C_4": "Intermedio",
"p10_1": "si",
"p10_2": "si",
"p10_3": "si",
"p11_1": "Nunca",
"p11_2": "Rara vez",
"p11_3": "Algunas veces",
"p11_4": "Siempre",
"p17_1": "si",
"p17_2": "no",
"p17_3": "si",
"p3_1": "si",
"p3_2": "si",
"p3_3": "si",
"p3_4": "si",
"p12_D_1": "Destacado",
"p12_D_2": "Destacado",
"p12_D_3": "Destacado",
"p12_D_4": "Destacado",
"p12_D_5": "Destacado",
"p2": "Deficiente",
"p4": "No",
"p5": "respuesta5",
"p6": "Sí",
"p7": "Sí",
"p8": "respuesta8",
"p9": "Sí",
"p13": "Responsable directo del programa",
"p14": "Se te otorgó de acuerdo a lo establecido",
"p15": "Sí",
"p16": "respuesta 16",
"p18": "respuesta18"
}
-->
*/
@@ -1,105 +0,0 @@
const fs = require('fs');
const { convertArrayToCSV } = require('convert-array-to-csv');
const { Op } = require('sequelize');
const helperPath = '../../helper';
const helper = require(`${helperPath}/helper`);
const { validarNumero } = require(`${helperPath}/validar`);
const dbPath = '../../db/tablas';
const Carrera = require(`${dbPath}/Carrera`);
const CuestionarioPrograma2 = require(`${dbPath}/CuestionarioPrograma`);
const Servicio = require(`${dbPath}/Servicio`);
const Programa = require(`${dbPath}/Programa`);
const Usuario = require(`${dbPath}/Usuario`);
const get = async (body) => {
const year = validarNumero(body.year, 'año', true, 4);
const path = `server/uploads/${year}_cuestionario_programa.csv`;
const data = [];
return CuestionarioPrograma2.findAll({
where: {
idCuestionarioPrograma2: {
[Op.not]: null,
},
},
})
.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);
}
/* return Servicio.findAll({
include: [
{
model: CuestionarioPrograma,
where: { idCuestionarioPrograma: { [Op.not]: null } },
},
{ model: Programa, where: { clavePrograma: { [Op.like]: `${year}-%` } } },
{ model: Usuario },
{ model: Carrera },
],
order: [['createdAt']],
})
.then(async (res) => {
for (let i = 0; i < res.length; i++)
data.push({
idServicio: res[i].idServicio,
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,
actividad2: res[i].CuestionarioPrograma.actividad2,
actividad3: res[i].CuestionarioPrograma.actividad3,
actividad4: res[i].CuestionarioPrograma.actividad4,
actividad5: res[i].CuestionarioPrograma.actividad5,
retroalimentacion: res[i].CuestionarioPrograma.retroalimentacion,
p6: res[i].CuestionarioPrograma.p6,
p7: res[i].CuestionarioPrograma.p7,
createdAt: res[i].CuestionarioPrograma.createdAt,
});
await helper.eliminarArchivo(path).catch((err) => {
console.log(err);
});
return helper.crearArchivo(path, convertArrayToCSV(data));
})
.then((res) => path);
*/
module.exports = get;
@@ -1,249 +0,0 @@
const validar = require('../../helper/validar');
const dbPath = '../../db/tablas';
const CuestionarioAlumno = require(`${dbPath}/CuestionarioAlumno`);
const CuestionarioPrograma2 = require(`${dbPath}/CuestionarioPrograma2`);
const Cuestionario = require(`${dbPath}/Cuestionario`);
const Servicio = require(`${dbPath}/Servicio`);
const nuevo = async (body) => {
// console.log(body);
let idServicio = body.idServicio;
/*
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.idCuestionarioAlumno)
throw new Error(
'Este Servicio Social ya cuenta con cuestionario de programa'
); */
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 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);
let respuestasRegistradas = await CuestionarioPrograma2.create({
...body,
idCuestionario: cuestionarioRegistro.idCuestionario
});
console.log('despues de registrar cuestionario', respuestasRegistradas);
// si el cuestionario ya existe solo hay que actualizar el id de cuestionarioprograma o alumno
return cuestionarioRegistro;
})
.then((res) => ({
message: `Se guardaron tus respuestas correctamente. ${res}`,
}));
};
const convertirSTR = () => {
for (let i = 0; i < body.p3.length; i++) {
p3 += body.p3[i];
if (i < body.p3.length - 1) p3 += ',';
}
for (let i = 0; i < body.p5.length; i++) {
p5 += body.p5[i];
if (i < body.p5.length - 1) p5 += ',';
}
for (let i = 0; i < body.p8.length; i++) {
p8 += body.p8[i];
if (i < body.p8.length - 1) p8 += ',';
}
for (let i = 0; i < body.p14.length; i++) {
p14 += body.p14[i];
if (i < body.p14.length - 1) p14 += ',';
}
for (let i = 0; i < body.p15.length; i++) {
p15 += body.p15[i];
if (i < body.p15.length - 1) p15 += ',';
}
for (let i = 0; i < body.p17.length; i++) {
p17 += body.p17[i];
if (i < body.p17.length - 1) p17 += ',';
}
for (let i = 0; i < body.p21.length; i++) {
p21 += body.p21[i];
if (i < body.p21.length - 1) p21 += ',';
}
for (let i = 0; i < body.p22.length; i++) {
p22 += body.p22[i];
if (i < body.p22.length - 1) p22 += ',';
}
for (let i = 0; i < body.p23.length; i++) {
p23 += body.p23[i];
if (i < body.p23.length - 1) p23 += ',';
}
for (let i = 0; i < body.p24.length; i++) {
p24 += body.p24[i];
if (i < body.p24.length - 1) p24 += ',';
}
};
module.exports = nuevo;
/*
<!-- respuestas de cuestionario formulario2
todas las preguntas se guardan correctamente
{
"p3_A_1": "Deficiente",
"p3_A_2": "Deficiente",
"p3_A_3": "Deficiente",
"p3_A_4": "Deficiente",
"p3_B_1": "Básico",
"p3_B_2": "Básico",
"p3_B_3": "Básico",
"p3_B_4": "Básico",
"p3_C_1": "Intermedio",
"p3_C_2": "Intermedio",
"p3_C_3": "Intermedio",
"p3_C_4": "Intermedio",
"p3_C_5": "Intermedio",
"p3_D_1": "Destacado",
"p3_D_2": "Destacado",
"p3_D_3": "Destacado",
"p3_D_4": "Destacado",
"p3_D_5": "Destacado",
"p3_E_1": "Deficiente",
"p1": "respuesta1",
"p2": "Excelente",
"p4": "respuesta4",
"p5": "Sí",
"p6": "respuesta 6"
}
-->
<!-- respuestas de cuestionario formulario alumno
{
"p1": [
"Dependencia de la UNAM",
"Asesoría académica",
"Oportunidad de desarrollo de tesis"
],
"p12_A_1": "Deficiente",
"p12_A_2": "Deficiente",
"p12_A_3": "Deficiente",
"p12_A_4": "Deficiente",
"p12_B_1": "Básico",
"p12_B_2": "Básico",
"p12_B_3": "Básico",
"p12_B_4": "Básico",
"p12_C_1": "Intermedio",
"p12_C_2": "Intermedio",
"p12_C_3": "Intermedio",
"p12_C_4": "Intermedio",
"p10_1": "si",
"p10_2": "si",
"p10_3": "si",
"p11_1": "Nunca",
"p11_2": "Rara vez",
"p11_3": "Algunas veces",
"p11_4": "Siempre",
"p17_1": "si",
"p17_2": "no",
"p17_3": "si",
"p3_1": "si",
"p3_2": "si",
"p3_3": "si",
"p3_4": "si",
"p12_D_1": "Destacado",
"p12_D_2": "Destacado",
"p12_D_3": "Destacado",
"p12_D_4": "Destacado",
"p12_D_5": "Destacado",
"p2": "Deficiente",
"p4": "No",
"p5": "respuesta5",
"p6": "Sí",
"p7": "Sí",
"p8": "respuesta8",
"p9": "Sí",
"p13": "Responsable directo del programa",
"p14": "Se te otorgó de acuerdo a lo establecido",
"p15": "Sí",
"p16": "respuesta 16",
"p18": "respuesta18"
}
-->
*/
@@ -1,5 +1,5 @@
const helperPath = '../../helper';
//const drive = require(`${helperPath}/drive`);
const drive = require(`${helperPath}/drive`);
const validar = require(`${helperPath}/validar`);
const Servicio = require('../../db/tablas/Servicio');
@@ -23,13 +23,13 @@ const cartaTermino = async (body, file) => {
if (res.cartaAceptacion)
throw new Error('Ya se subio la Carta de Aceptación.');
switch (res.idStatus) {
/* case 7:
case 7:
return drive.uploadFile(
path,
`Carta_Aceptacion.pdf`,
'application/pdf',
res.carpeta
); */
);
case 1:
throw new Error(
'Esta linea de la API solo puede ser usada cuando es estatus del Servicio Social sea 7.'
+3 -3
View File
@@ -1,5 +1,5 @@
const helperPath = '../../helper';
//const drive = require(`${helperPath}/drive`);
const drive = require(`${helperPath}/drive`);
const validar = require(`${helperPath}/validar`);
const Servicio = require('../../db/tablas/Servicio');
@@ -23,13 +23,13 @@ const cartaTermino = async (body, file) => {
if (res.cartaTermino) throw new Error('Ya se subio la Carta de Termino.');
switch (res.idStatus) {
case 4:
/* case 8:
case 8:
return drive.uploadFile(
path,
`Carta_Termino.pdf`,
'application/pdf',
res.carpeta
); */
);
case 1:
case 2:
case 3:
+3 -3
View File
@@ -1,5 +1,5 @@
const helperPath = '../../helper';
//const drive = require(`${helperPath}/drive`);
const drive = require(`${helperPath}/drive`);
const validar = require(`${helperPath}/validar`);
const Servicio = require('../../db/tablas/Servicio');
@@ -23,13 +23,13 @@ const informeGlobal = async (body, file) => {
if (res.informeGlobal) throw new Error('Ya se subio el Informe Global.');
switch (res.idStatus) {
case 4:
/* case 9:
case 9:
return drive.uploadFile(
path,
`Informe_Global.pdf`,
'application/pdf',
res.carpeta
); */
);
case 1:
case 2:
case 3:
+3 -3
View File
@@ -1,6 +1,6 @@
const { Op } = require('sequelize');
const helperPath = '../../helper';
//const drive = require(`${helperPath}/drive`);
const drive = require(`${helperPath}/drive`);
const validar = require(`${helperPath}/validar`);
const dbPath = '../../db/tablas';
const Carrera = require(`${dbPath}/Carrera`);
@@ -79,7 +79,7 @@ const nuevo = async (body, file) => {
.then((servicio) => {
let carpeta = '';
/* drive
drive
.mkDir(numeroCuenta)
.then((res) => {
carpeta = res;
@@ -95,7 +95,7 @@ const nuevo = async (body, file) => {
{ carpeta, cartaAceptacion: res },
{ where: { idServicio: servicio.idServicio } }
)
); */
);
return { message: `Se Pre-Registro correctamente a este alumno.` };
});
};
+1 -6
View File
@@ -1,5 +1,5 @@
const helperPath = '../../helper';
//const drive = require(`${helperPath}/drive`);
const drive = require(`${helperPath}/drive`);
const validar = require(`${helperPath}/validar`);
const Servicio = require('../../db/tablas/Servicio');
@@ -13,8 +13,6 @@ const update = async (body, files) => {
return Servicio.findOne({ where: { idServicio } })
.then(async (res) => {
if (!res) throw new Error('Este Servicio Social no existe en la db.');
/*
try {
if (files['cartaAceptacion'][0].filename)
dataUpdate.cartaAceptacion = await drive.uploadFile(
@@ -42,9 +40,6 @@ const update = async (body, files) => {
res.carpeta
);
} catch (err) {}
*/
if (body.correo) dataUpdate.correo = validar.validarCorreo(body.correo);
if (body.fechaInicio)
dataUpdate.fechaInicio = validar.validarFecha(
-34
View File
@@ -11,11 +11,6 @@ const Status = require('./tablas/Status');
const TipoUsuario = require('./tablas/TipoUsuario');
const Usuario = require('./tablas/Usuario');
const CuestionarioAlumno2 = require('./tablas/CuestionarioAlumno');
const CuestionarioPrograma2 = require('./tablas/CuestionarioPrograma');
const drop = async () => {
console.log('\nPaso 1) Desinstalando la db.'.bold.blue);
@@ -38,20 +33,6 @@ const drop = async () => {
'La tabla CuestionarioAlumno 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
);
await Programa.drop();
console.log('La tabla Programa se desinstalo correctamente.'.magenta);
@@ -88,21 +69,6 @@ const sync = async () => {
'La tabla CuestionarioPrograma 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
);
await Carrera.sync();
console.log('La tabla Carrera se instalo correctamente.'.magenta);
-123
View File
@@ -1,123 +0,0 @@
/*
const { DataTypes, Model } = require('sequelize');
const sequelize = require('../../config/sequelize.conf');
const Usuario = require('./Usuario');
const Carrera = require('./Carrera');
const Programa = require('./Programa');
const Servicio = require('./Servicio');
const CuestionarioAlumno2 = require('./CuestionarioAlumno2');
const CuestionarioPrograma2 = require('./CuestionarioPrograma2');
class Cuestionario extends Model {}
Cuestionario.init(
{
idCuestionario: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
idServicio: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: Servicio,
key: 'idServicio',
},
},
version: {
type: DataTypes.STRING(50),
allowNull: false,
},
titulo: {
type: DataTypes.STRING(50),
allowNull: false,
},
desc: {
type: DataTypes.STRING(50),
allowNull: false,
},
dirigidoA: {
type: DataTypes.STRING(50),
allowNull: false,
},
createdAt: {
type: DataTypes.DATE,
allowNull: false,
},
},
{
sequelize,
modelName: 'Cuestionario',
tableName: 'Cuestionario',
timestamps: false,
}
);
Cuestionario.belongsTo(Servicio, { foreignKey: 'idServicio' });
Servicio.hasMany(Cuestionario, { foreignKey: 'idServicio' });
Cuestionario.belongsTo(CuestionarioAlumno2, { foreignKey: 'idCuestionarioAlumno2' });
CuestionarioAlumno2.hasOne(Cuestionario, { foreignKey: 'idCuestionarioAlumno2' });
Cuestionario.belongsTo(CuestionarioPrograma2, { foreignKey: 'idCuestionarioPrograma2' });
CuestionarioPrograma2.hasOne(Cuestionario, { foreignKey: 'idCuestionarioPrograma2' });
module.exports = Cuestionario;
*/
const { DataTypes, Model } = require('sequelize');
const sequelize = require('../../config/sequelize.conf');
const Servicio = require('./Servicio');
class Cuestionario extends Model {}
Cuestionario.init(
{
idCuestionario: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
idServicio: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: Servicio,
key: 'idServicio',
},
},
version: DataTypes.STRING(50),
titulo: DataTypes.STRING(50),
desc: DataTypes.STRING(50),
dirigidoA: DataTypes.STRING(50),
createdAt: DataTypes.DATE,
},
{
sequelize,
modelName: 'Cuestionario',
tableName: 'Cuestionario',
timestamps: false,
}
);
Cuestionario.belongsTo(Servicio, { foreignKey: 'idServicio' });
Servicio.hasMany(Cuestionario, { foreignKey: 'idServicio' });
module.exports = Cuestionario;
-483
View File
@@ -1,483 +0,0 @@
/*
const { DataTypes, Model } = require('sequelize');
const sequelize = require('../../config/sequelize.conf');
const Cuestionario = require('./Cuestionario');
class CuestionarioAlumno2 extends Model {}
CuestionarioAlumno2.init(
{
idCuestionarioAlumno2: {
type: DataTypes.INTEGER,
primaryKey: true,
allowNull: false,
unique: true,
autoIncrement: true,
},
idCuestionario: {
type: DataTypes.INTEGER,
allowNull: 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, // Ajusta según tus necesidades
}
);
CuestionarioAlumno2.belongsTo(Cuestionario, { foreignKey: 'idCuestionario' });
Cuestionario.hasMany(CuestionarioAlumno2, { foreignKey: 'idCuestionario' });
module.exports = CuestionarioAlumno2;
*/
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,
},
idCuestionario: {
type: DataTypes.INTEGER,
allowNull: 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,
}
);
// Importación después de la definición para evitar dependencias circulares
const Cuestionario = require('./Cuestionario');
// Definir relaciones después de importar correctamente
CuestionarioAlumno2.belongsTo(Cuestionario, { foreignKey: 'idCuestionario' });
Cuestionario.hasMany(CuestionarioAlumno2, { foreignKey: 'idCuestionario' });
module.exports = CuestionarioAlumno2;
-154
View File
@@ -1,154 +0,0 @@
const { DataTypes, Model } = require('sequelize');
const sequelize = require('../../config/sequelize.conf');
const Cuestionario = require('./Cuestionario');
class CuestionarioPrograma2 extends Model {}
CuestionarioPrograma2.init(
{
idCuestionarioPrograma2: {
type: DataTypes.INTEGER,
primaryKey: true,
allowNull: false,
unique: true,
autoIncrement: true,
},
idCuestionario: {
type: DataTypes.INTEGER,
allowNull: 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,
}
);
CuestionarioPrograma2.belongsTo(Cuestionario, { foreignKey: 'idCuestionario' });
Cuestionario.hasMany(CuestionarioPrograma2, { foreignKey: 'idCuestionario' });
module.exports = CuestionarioPrograma2;
+4 -4
View File
@@ -2,7 +2,7 @@ const dudasAlumno = `Cualquier duda puedes acudir a las ventanillas de servicio
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
Departamento de Servicio Social y Bolsa de Trabajo
FES Acatlán
`;
@@ -19,7 +19,7 @@ En el sistema que se te indicó podrás dar seguimiento al resto de tu trámite
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 https://bit.ly/informe-serviciosocialFESA, 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 http://bit.ly/informeglobal-FESA, 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.
@@ -216,13 +216,13 @@ Lic. Marcela Martínez Rangel
56231600
sesocial@acatlan.unam.mx.
Lic. Ivette Selene Hernández Rios
Mtra. Adriana Roque del Angel
56231600
sesoprof@acatlan.unam.mx
Atentamente
Lic. Ivette Selene Hernández Rios
Mtra. Adriana Roque del Angel
Jefa del Departamento de Servicio Social, Desarrollo Profesional e Inserción Laboral
`,
};
+63 -18
View File
@@ -1,7 +1,7 @@
require('../config/config');
const fs = require('fs');
const { google } = require('googleapis');
//const drive = google.drive('v3');
const drive = google.drive('v3');
const credenciales = JSON.parse(fs.readFileSync('./cred.json', 'utf8'));
const jwtClient = new google.auth.JWT(
credenciales.client_email,
@@ -10,11 +10,14 @@ const jwtClient = new google.auth.JWT(
['https://www.googleapis.com/auth/drive']
);
const Servicio = require(`../db/tablas/Servicio`);
const Usuario = require(`../db/tablas/Usuario`);
const list = (pageToken) => {
return new Promise((resolve, reject) => {
jwtClient.authorize((err, tokens) => {
if (err) reject('Error de autorización: ' + err);
/* drive.files.list(
drive.files.list(
{
auth: jwtClient,
corpora: 'user',
@@ -30,7 +33,7 @@ const list = (pageToken) => {
if (err) reject('Ha habido un error en la petición: ' + err);
resolve(resp.data);
}
); */
);
});
});
};
@@ -42,7 +45,7 @@ const deleteFile = (fileId) => {
return new Promise((resolve, reject) => {
jwtClient.authorize(async (err, tokens) => {
if (err) reject(err);
/* drive.files.delete(
drive.files.delete(
{
fileId,
auth: jwtClient,
@@ -51,7 +54,7 @@ const deleteFile = (fileId) => {
if (err) reject(err);
resolve(resp);
}
); */
);
});
});
};
@@ -70,7 +73,7 @@ const uploadFile = (path, name, mimeType, parent) => {
jwtClient.authorize(function (err, tokens) {
if (err) reject('Error de autorización: ' + err);
/* drive.files.create(
drive.files.create(
{
media,
requestBody,
@@ -82,7 +85,7 @@ const uploadFile = (path, name, mimeType, parent) => {
fs.unlinkSync(path);
resolve(file.data.id);
}
); */
);
});
});
};
@@ -98,7 +101,7 @@ const mkDir = (name) => {
jwtClient.authorize((err, tokens) => {
if (err) reject('Error de autorización: ' + err);
/* drive.files.create(
drive.files.create(
{
fields: 'id',
auth: jwtClient,
@@ -108,7 +111,7 @@ const mkDir = (name) => {
if (err) reject(err);
resolve(res.data.id);
}
); */
);
});
});
};
@@ -118,13 +121,13 @@ 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(
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);
}
); */
);
});
});
};
@@ -146,13 +149,24 @@ const folder = async (numeroCuenta) => {
return mkDir(numeroCuenta);
};
// 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);
// });
// };
const borrarTodo = () => {
return findAll().then(async ({ folders, pdfs }) => {
console.log('Eliminando pdfs');
for (let i = 0; i < pdfs.length; i++) {
if (pdfs[i] !== process.env.CARPETA) {
await deleteFile(pdfs[i]);
console.log(`${i + 1}/${pdfs.length}`);
}
}
console.log('Eliminando folders');
for (let i = 0; i < folders.length; i++) {
if (folders[i] !== process.env.CARPETA) {
await deleteFile(folders[i]);
console.log(`${i + 1}/${folders.length}`);
}
}
});
};
const findAll = async () => {
const folders = [];
@@ -175,6 +189,37 @@ const findAll = async () => {
return { folders, pdfs };
};
const scriptCambioDeCarpeta = async () => {
console.log('Entrando a scriptCambioDeCarpeta');
const servicios = await Servicio.findAll({
where: { idStatus: [1, 2, 3, 4, 5, 7, 8, 9] },
include: [{ model: Usuario }],
});
for (let i = 0; i < servicios.length; i++) {
// por cada cuenta
console.log(`${i + 1}/${servicios.length}`);
if (servicios[i].idStatus === 6) {
console.log('algo mal');
console.log(servicios[i]);
}
const carpetaCreada = await mkDir(`${servicios[i].Usuario.usuario}`); //se crea una crapeta dentro de la carpeta cuyo id guardamos antes y guardamos el id de la carpeta creada
await Servicio.update(
{ carpeta: carpetaCreada },
{ where: { idServicio: servicios[i].idServicio } }
); // se actualiza el id de la carpeta por la que se acaba de crear
console.log(
`${i} - [${servicios[i].idServicio}] [${servicios[i].Usuario.usuario}] : [${carpetaCreada}] - [${servicios[i].carpeta}]`
);
}
console.log('Saliendo de scriptCambioDeCarpeta');
};
// scriptCambioDeCarpeta();
// borrarTodo();
module.exports = {
folder,
uploadFile,
+2 -54
View File
@@ -174,11 +174,8 @@ const validarPreTermino = (idServicio) => {
return Servicio.findOne({ where: { idServicio } })
.then((res) => {
if (
// se tiene que validar buscando en la tabla de cuestionarios
//res.idCuestionarioPrograma &&
//res.idCuestionarioAlumno &&
res.idCuestionarioPrograma &&
res.idCuestionarioAlumno &&
res.cartaTermino &&
res.informeGlobal
)
@@ -192,51 +189,6 @@ const validarPreTermino = (idServicio) => {
);
};
const validarCuestionarioAlumno2 = (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 validarCuestionarioPrograma2 = (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;
};
module.exports = {
yaExiste,
noValido,
@@ -251,8 +203,4 @@ module.exports = {
validarNumero,
validarObjetoVacio,
validarPreTermino,
validarCuestionarioAlumno2,
validarCuestionarioPrograma2
};
+3 -40
View File
@@ -3,12 +3,10 @@ const app = express();
const { verificaToken } = require('../middleware/autentificacion');
const route = '/cuestionario_alumno';
const controllerPath = '../controller/CuestionarioAlumno';
const get = require(`${controllerPath}/get`);
const nuevo = require(`${controllerPath}/nuevo`);
const controllerPath2 = '../controller/CuestionarioAlumno2';
const get = require(`${controllerPath2}/get`);
const nuevo = require(`${controllerPath2}/nuevo`);
/* // POST
// POST
app.post(`${route}`, verificaToken, (req, res) => {
return nuevo(req.body)
.then((data) => {
@@ -26,43 +24,8 @@ app.get(`${route}`, verificaToken, (req, res) => {
res.download(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
}); */
// POST
app.post(`${route}/v2`, (req, res) => {
console.log(`${route}/v2`);
return nuevo(req.body)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(err);
res.status(400).json({ message: err.message });
});
});
// GET
app.get(`${route}/v2`, (req, res) => {
console.log(`${route}/v2`);
return get(req.query)
.then((data) => {
res.download(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
module.exports = app;
+1 -30
View File
@@ -2,7 +2,7 @@ const express = require('express');
const app = express();
const { verificaToken } = require('../middleware/autentificacion');
const route = '/cuestionario_programa';
const controllerPath = '../controller/CuestionarioPrograma2';
const controllerPath = '../controller/CuestionarioPrograma';
const get = require(`${controllerPath}/get`);
const nuevo = require(`${controllerPath}/nuevo`);
@@ -28,33 +28,4 @@ app.get(`${route}`, verificaToken, (req, res) => {
});
});
app.post(`${route}/v2`, (req, res) => {
console.log(`${route}/v2`);
return nuevo(req.body)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
console.log(err);
res.status(400).json({ message: err.message });
});
});
// GET
app.get(`${route}/v2`, (req, res) => {
console.log(`${route}/v2`);
return get(req.query)
.then((data) => {
res.download(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
module.exports = app;
-1
View File
@@ -4,7 +4,6 @@ const app = express();
app.use(require('./CasoEspecial'));
app.use(require('./CuestionarioAlumno'));
app.use(require('./CuestionarioPrograma'));
app.use(require('./Programa'));
app.use(require('./Servicio'));
app.use(require('./Status'));
-10
View File
@@ -1,10 +0,0 @@
PORT=3000
DB = servicio_test
USERDB = root
PASSWORDDB = mypass
HOSTDB = host.docker.internal
TYPEDB = mariadb
ESCOLARES = 127.0.0.1
ESCOLARES_PASS = mypass
-127
View File
@@ -1,127 +0,0 @@
/* CREATE TABLE `servicio` (
`idServicio` INT PRIMARY KEY
); */
--DROP TABLE IF EXISTS `Cuestionario`;
CREATE TABLE
`Cuestionario` (
`idCuestionario` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
`idServicio` INT,
`version` VARCHAR(50),
`titulo` VARCHAR(50),
`desc` VARCHAR(50),
`dirigidoA` VARCHAR(50),
`createdAt` DATETIME
);
--`idCuestionarioAlumno` INT, -- Agregado para relación con alumnos
--`idCuestionarioPrograma` INT, -- Agregado para relación con programas
-- `idCuestionarioAlumno1` INT, -- Agregado para relación con alumnos
-- `idCuestionarioPrograma1` INT, -- Agregado para relación con programas
DROP TABLE IF EXISTS `cuestionario_alumno_2`;
CREATE TABLE
`cuestionario_alumno_2` (
`idCuestionarioAlumno2` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
`idCuestionario` INT,
`createdAt` DATETIME,
`p12_A_1` VARCHAR(50),
`p12_A_2` VARCHAR(50),
`p12_A_3` VARCHAR(50),
`p12_A_4` VARCHAR(50),
`p12_B_1` VARCHAR(50),
`p12_B_2` VARCHAR(50),
`p12_B_3` VARCHAR(50),
`p12_B_4` VARCHAR(50),
`p12_C_1` VARCHAR(50),
`p12_C_2` VARCHAR(50),
`p12_C_3` VARCHAR(50),
`p12_C_4` VARCHAR(50),
`p10_1` VARCHAR(50),
`p10_2` VARCHAR(50),
`p10_3` VARCHAR(50),
`p11_1` VARCHAR(50),
`p11_2` VARCHAR(50),
`p11_3` VARCHAR(50),
`p11_4` VARCHAR(50),
`p17_1` VARCHAR(50),
`p17_2` VARCHAR(50),
`p17_3` VARCHAR(50),
`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` VARCHAR(150),
`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,
`idCuestionario` INT,
`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)
);
-- Relaciones corregidas
ALTER TABLE `Cuestionario` ADD FOREIGN KEY (`idServicio`) REFERENCES `servicio` (`idServicio`);
ALTER TABLE cuestionario_alumno ADD COLUMN idCuestionario INT;
ALTER TABLE cuestionario_programa ADD COLUMN idCuestionario INT;
ALTER TABLE `cuestionario_alumno` ADD FOREIGN KEY (`idCuestionario`) REFERENCES `Cuestionario` (`idCuestionario`);
ALTER TABLE `cuestionario_alumno_2` ADD FOREIGN KEY (`idCuestionario`) REFERENCES `Cuestionario` (`idCuestionario`);
ALTER TABLE `cuestionario_programa` ADD FOREIGN KEY (`idCuestionario`) REFERENCES `Cuestionario` (`idCuestionario`);
ALTER TABLE `cuestionario_programa_2` ADD FOREIGN KEY (`idCuestionario`) REFERENCES `Cuestionario` (`idCuestionario`);
--ALTER TABLE `Cuestionario`
--ADD FOREIGN KEY (`idCuestionarioAlumno`) REFERENCES `cuestionario_alumno_2` (`idCuestionarioAlumno2`);
--ALTER TABLE `Cuestionario`
--ADD FOREIGN KEY (`idCuestionarioPrograma`) REFERENCES `cuestionario_programa_2` (`idCuestionarioPrograma2`);
--ALTER TABLE `Cuestionario`
--ADD FOREIGN KEY (`idCuestionarioAlumno1`) REFERENCES `cuestionario_alumno` (`idCuestionarioAlumno`);
--ALTER TABLE `Cuestionario`
--ADD FOREIGN KEY (`idCuestionarioPrograma1`) REFERENCES `cuestionario_programa` (`idCuestionarioPrograma`);