Se agrego el id del peridodo en automatico al momeno de registrar

This commit is contained in:
Patriots01
2026-02-05 00:49:38 +00:00
parent 83260468b5
commit 13d3981f58
3 changed files with 1382 additions and 3019 deletions
+1364 -3014
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -17,8 +17,8 @@
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.25.0",
"bcrypt": "^5.0.1",
"axios": "^1.13.4",
"bcrypt": "^6.0.0",
"body-parser": "^1.19.0",
"colors": "^1.4.0",
"convert-array-to-csv": "^2.0.0",
@@ -28,10 +28,10 @@
"express": "^4.17.1",
"fs": "^0.0.1-security",
"gmail-send": "^1.8.14",
"jsonwebtoken": "^8.5.1",
"jsonwebtoken": "^9.0.3",
"mariadb": "^2.5.3",
"moment": "^2.29.1",
"multer": "^1.4.4",
"multer": "^2.0.2",
"nodemailer": "^7.0.5",
"sequelize": "^6.6.2",
"validator": "^13.6.0"
@@ -37,10 +37,23 @@ async function realizarInscripcion(req, res) {
});
}
// Validacion del periodo
const periodoActivo = await Periodo.findOne({
where: {
activo: 1 // o true
}
});
if (!periodoActivo) {
throw new Error("No hay un periodo activo");
}
// 3. Crear inscripción
await AlumnoInscrito.create({
id_cuenta: usuario.id_cuenta,
id_periodo: 27,
id_periodo: periodoActivo.id_periodo,
id_plataforma: 5,
fecha_inscripcion: new Date(),
tiempo_disponible: 3600,