db tamaños de strings mejorados

This commit is contained in:
2020-11-17 17:27:12 -06:00
parent 6ff3720f32
commit 1caa2017c0
11 changed files with 26 additions and 25 deletions
+1 -1
View File
@@ -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,
+1 -3
View File
@@ -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.`,
};
});
};
+6 -3
View File
@@ -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,