asc and desc

This commit is contained in:
Andres2908
2022-09-08 13:32:28 -05:00
parent ce6dc0405d
commit a553e92f0f
@@ -6,13 +6,15 @@ const { validarNumeroEntero } = require('../../helper/validar');
const todasInscripciones = async (body) => {
const validacion = validarNumeroEntero(body.validacion, 'validacion', true);
const order = validacion === 2 ? [['idInscripcion', 'ASC']] : [['idInscripcion', 'DESC']];
console.log(order)
return Inscripcion.findAll({
where: {
validacion,
cancelacion: 0,
idPeriodo: Number(process.env.PERIODO),
},
order: [['idInscripcion', 'DESC']],
order: order,
include: [
{
model: Usuario,