diff --git a/server/controller/Servicio/alumno.js b/server/controller/Servicio/alumno.js deleted file mode 100644 index e69de29..0000000 diff --git a/server/controller/Servicio/get.js b/server/controller/Servicio/get.js index feaa054..d10dce1 100644 --- a/server/controller/Servicio/get.js +++ b/server/controller/Servicio/get.js @@ -18,10 +18,10 @@ const get = (body) => { { model: Programa }, ], }).then((res) => { + if (!res) throw new Error('No existe este servicio social.'); return { idServicio: res.idServicio, creditos: res.creditos, - nombre: res.nombre, correo: res.correo, telefono: res.telefono, direccion: res.direccion, diff --git a/server/controller/Servicio/nuevo.js b/server/controller/Servicio/nuevo.js index 669f9b7..bfd0ddd 100644 --- a/server/controller/Servicio/nuevo.js +++ b/server/controller/Servicio/nuevo.js @@ -10,7 +10,6 @@ const nuevo = async (body) => { let idPrograma = validar.validarId(body.idPrograma); let idCarrera = validar.validarId(body.idCarrera); let creditos = validar.validarNumero(body.creditos); - let nombre = validar.validarTexto(body.nombre); let correo = validar.validarCorreo(body.correo); let fechaInicio = validar.validarFecha(body.fechaInicio); let fechaFin = validar.validarFecha(body.fechaFin); @@ -42,7 +41,6 @@ const nuevo = async (body) => { idPrograma, idCarrera, creditos, - nombre, correo, fechaInicio, fechaFin, @@ -52,7 +50,7 @@ const nuevo = async (body) => { }) .then((res) => { return { - message: `Se Pre-Registro correctamente al alumno ${res.nombre}`, + message: `Se Pre-Registro correctamente al alumno.`, }; }); }; diff --git a/server/controller/Servicio/responsable.js b/server/controller/Servicio/responsable.js deleted file mode 100644 index e69de29..0000000 diff --git a/server/controller/Servicio/serviciosAdmin.js b/server/controller/Servicio/serviciosAdmin.js index 890a94b..21e9f36 100644 --- a/server/controller/Servicio/serviciosAdmin.js +++ b/server/controller/Servicio/serviciosAdmin.js @@ -16,7 +16,7 @@ const serviciosAdmin = async (body) => { let numeroCuenta = body.numeroCuenta ? validar.validarNumeroCuenta(body.numeroCuenta) : ''; - let where = { nombre: { [Op.like]: `%${nombre}%` } }; + let where = {}; if (idStatus) where.idStatus = idStatus; return Usuario.findOne({ where: { idUsuario } }) @@ -30,7 +30,10 @@ const serviciosAdmin = async (body) => { { model: Usuario, include: { model: TipoUsuario }, - where: { usuario: { [Op.like]: `%${numeroCuenta}%` } }, + where: { + usuario: { [Op.like]: `%${numeroCuenta}%` }, + nombre: { [Op.like]: `%${nombre}%` }, + }, }, { model: Carrera }, { model: Status }, @@ -43,12 +46,12 @@ const serviciosAdmin = async (body) => { for (let i = pagina * 25 - 25; i < res.length && i < pagina * 25; i++) data.push({ idServicio: res[i].idServicio, - nombre: res[i].nombre, fechaInicio: res[i].fechaInicio, fechaFin: res[i].fechaFin, Usuario: { idUsuario: res[i].Usuario.idUsuario, usuario: res[i].Usuario.usuario, + nombre: res[i].Usuario.nombre, TipoUsuario: { idTipoUsuario: res[i].Usuario.TipoUsuario.idTipoUsuario, tipoUsuario: res[i].Usuario.TipoUsuario.tipoUsuario, diff --git a/server/controller/Servicio/serviciosResponsable.js b/server/controller/Servicio/serviciosResponsable.js index 1d5a113..fd20836 100644 --- a/server/controller/Servicio/serviciosResponsable.js +++ b/server/controller/Servicio/serviciosResponsable.js @@ -17,7 +17,7 @@ const serviciosResponsable = async (body) => { let numeroCuenta = body.numeroCuenta ? validar.validarNumeroCuenta(body.numeroCuenta) : ''; - let where = { nombre: { [Op.like]: `%${nombre}%` } }; + let where = {}; if (idStatus) where.idStatus = idStatus; return Usuario.findOne({ where: { idUsuario } }) @@ -32,7 +32,10 @@ const serviciosResponsable = async (body) => { { model: Usuario, include: { model: TipoUsuario }, - where: { usuario: { [Op.like]: `%${numeroCuenta}%` } }, + where: { + usuario: { [Op.like]: `%${numeroCuenta}%` }, + nombre: { [Op.like]: `%${nombre}%` }, + }, }, { model: Carrera }, { model: Status }, @@ -45,7 +48,6 @@ const serviciosResponsable = async (body) => { for (let i = pagina * 25 - 25; i < res.length && i < pagina * 25; i++) data.push({ idServicio: res[i].idServicio, - nombre: res[i].nombre, fechaInicio: res[i].fechaInicio, fechaFin: res[i].fechaFin, idCuestionarioAlumno: res[i].idCuestionarioAlumno, @@ -53,6 +55,7 @@ const serviciosResponsable = async (body) => { Usuario: { idUsuario: res[i].Usuario.idUsuario, usuario: res[i].Usuario.usuario, + nombre: res[i].Usuario.nombre, TipoUsuario: { idTipoUsuario: res[i].Usuario.TipoUsuario.idTipoUsuario, tipoUsuario: res[i].Usuario.TipoUsuario.tipoUsuario, diff --git a/server/controller/Usuario/escolares.js b/server/controller/Usuario/escolares.js index ddbf028..8cf80b3 100644 --- a/server/controller/Usuario/escolares.js +++ b/server/controller/Usuario/escolares.js @@ -1,5 +1,5 @@ -const validar = require('../../helper/validar'); require('../../config/config'); +const validar = require('../../helper/validar'); const axios = require('axios'); const Usuario = require('../../db/tablas/Usuario'); const Carrera = require('../../db/tablas/Carrera'); @@ -40,6 +40,7 @@ const escolares = async (body) => { return Usuario.create({ usuario: numeroCuenta, activo: false, + nombre: alumno.nombre, idTipoUsuario: 3, }); return res; diff --git a/server/db/tablas/Servicio.js b/server/db/tablas/Servicio.js index af1ee93..9d34104 100644 --- a/server/db/tablas/Servicio.js +++ b/server/db/tablas/Servicio.js @@ -21,12 +21,8 @@ Servicio.init( type: DataTypes.STRING(3), allowNull: false, }, - nombre: { - type: DataTypes.STRING(40), - allowNull: false, - }, correo: { - type: DataTypes.STRING(80), + type: DataTypes.STRING(60), allowNull: false, }, telefono: { @@ -54,20 +50,20 @@ Servicio.init( defaultValue: null, }, carpeta: { - type: DataTypes.STRING(50), + type: DataTypes.STRING(60), allowNull: false, }, cartaAceptacion: { - type: DataTypes.STRING(50), + type: DataTypes.STRING(60), allowNull: false, }, cartaTermino: { - type: DataTypes.STRING(50), + type: DataTypes.STRING(60), allowNull: true, defaultValue: null, }, informeGlobal: { - type: DataTypes.STRING(50), + type: DataTypes.STRING(60), allowNull: true, defaultValue: null, }, diff --git a/server/db/tablas/Status.js b/server/db/tablas/Status.js index d61d649..fc9b2c9 100644 --- a/server/db/tablas/Status.js +++ b/server/db/tablas/Status.js @@ -12,7 +12,7 @@ Status.init( autoIncrement: true, }, status: { - type: DataTypes.STRING(50), + type: DataTypes.STRING(30), allowNull: false, }, }, diff --git a/server/db/tablas/TipoUsuario.js b/server/db/tablas/TipoUsuario.js index 081630b..deba06d 100644 --- a/server/db/tablas/TipoUsuario.js +++ b/server/db/tablas/TipoUsuario.js @@ -12,7 +12,7 @@ TipoUsuario.init( autoIncrement: true, }, tipoUsuario: { - type: DataTypes.STRING(50), + type: DataTypes.STRING(15), allowNull: false, }, }, diff --git a/server/db/tablas/Usuario.js b/server/db/tablas/Usuario.js index 3b8dd75..176bed3 100644 --- a/server/db/tablas/Usuario.js +++ b/server/db/tablas/Usuario.js @@ -13,16 +13,16 @@ Usuario.init( autoIncrement: true, }, usuario: { - type: DataTypes.STRING(80), + type: DataTypes.STRING(60), allowNull: false, }, password: { - type: DataTypes.STRING(100), + type: DataTypes.STRING(60), allowNull: true, defaultValue: null, }, nombre: { - type: DataTypes.STRING(40), + type: DataTypes.STRING(60), allowNull: true, defaultValue: null, },