db tamaños de strings mejorados
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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.`,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
|
||||
@@ -12,7 +12,7 @@ Status.init(
|
||||
autoIncrement: true,
|
||||
},
|
||||
status: {
|
||||
type: DataTypes.STRING(50),
|
||||
type: DataTypes.STRING(30),
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -12,7 +12,7 @@ TipoUsuario.init(
|
||||
autoIncrement: true,
|
||||
},
|
||||
tipoUsuario: {
|
||||
type: DataTypes.STRING(50),
|
||||
type: DataTypes.STRING(15),
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user