validar número
This commit is contained in:
@@ -10,7 +10,7 @@ const Servicio = require(`${dbPath}/Servicio`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const gustavoBazPrada = async (body) => {
|
||||
const year = validar.validarNumero(body.year, 4);
|
||||
const year = validar.validarNumero(body.year, 'año', true, 4);
|
||||
const inicio = moment(`${year}-01-31`);
|
||||
const fin = moment(`${parseInt(year) + 1}-01-31`);
|
||||
const path = `server/uploads/${year}_gustavo_baz_prada.csv`;
|
||||
|
||||
@@ -16,7 +16,7 @@ const nuevo = async (body, file) => {
|
||||
);
|
||||
const idCarrera = validar.validarNumeroEntero(body.idCarrera, 'id carrera');
|
||||
const numeroCuenta = validar.validarNumeroCuenta(body.numeroCuenta);
|
||||
const creditos = validar.validarNumero(body.creditos);
|
||||
const creditos = validar.validarNumero(body.creditos, 'créditos', true);
|
||||
const correo = validar.validarCorreo(body.correo);
|
||||
const fechaInicio = validar.validarFecha(
|
||||
body.fechaInicio,
|
||||
|
||||
@@ -17,7 +17,7 @@ const registroValidado = async (body) => {
|
||||
'fecha de nacimiento',
|
||||
false
|
||||
);
|
||||
const telefono = validar.validarNumero(body.telefono, 15);
|
||||
const telefono = validar.validarNumero(body.telefono, 'teléfono', true, 15);
|
||||
const direccion = validar.validarAlfanumerico(
|
||||
body.direccion,
|
||||
'dirección',
|
||||
|
||||
@@ -8,7 +8,14 @@ const Status = require(`${dbPath}/Status`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const serviciosAdmin = async (body) => {
|
||||
const pagina = validar.validarNumero(body.pagina, true);
|
||||
const pagina = validar.validarNumero(
|
||||
body.pagina,
|
||||
'página',
|
||||
false,
|
||||
null,
|
||||
true,
|
||||
true
|
||||
);
|
||||
const where = body.idStatus
|
||||
? { idStatus: validar.validarNumeroEntero(body.idStatus, 'id status') }
|
||||
: {};
|
||||
|
||||
@@ -9,7 +9,14 @@ const Status = require(`${dbPath}/Status`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const serviciosResponsable = async (body) => {
|
||||
const pagina = validar.validarNumero(body.pagina, true);
|
||||
const pagina = validar.validarNumero(
|
||||
body.pagina,
|
||||
'página',
|
||||
false,
|
||||
null,
|
||||
true,
|
||||
true
|
||||
);
|
||||
const idUsuario = validar.validarNumeroEntero(body.idUsuario, 'id usuario');
|
||||
const where = body.idStatus
|
||||
? { idStatus: validar.validarNumeroEntero(body.idStatus, 'id status') }
|
||||
|
||||
@@ -67,7 +67,12 @@ const update = async (body, files) => {
|
||||
200
|
||||
);
|
||||
if (body.telefono)
|
||||
dataUpdate.telefono = validar.validarNumero(body.telefono, 15);
|
||||
dataUpdate.telefono = validar.validarNumero(
|
||||
body.telefono,
|
||||
'teléfono',
|
||||
true,
|
||||
15
|
||||
);
|
||||
if (validar.validarObjetoVacio(dataUpdate))
|
||||
throw new Error(
|
||||
'No se envio nada para actualizar este Servicio Social'
|
||||
|
||||
Reference in New Issue
Block a user