From bbc3b1189d7fae41467348dc4860b30579174a94 Mon Sep 17 00:00:00 2001 From: Rik Smale <13023439+WikiRik@users.noreply.github.com> Date: Fri, 22 Sep 2023 15:46:31 +0200 Subject: [PATCH] fix(bodies): sort by default on name --- middlewares/bodies.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/middlewares/bodies.js b/middlewares/bodies.js index 0f281200..34aac49e 100644 --- a/middlewares/bodies.js +++ b/middlewares/bodies.js @@ -27,6 +27,10 @@ exports.listAllBodies = async (req, res) => { where.status = 'active'; } + if (!req.query.sort) { + req.query.sort = 'name'; + } + const result = await Body.findAndCountAll({ where, ...helpers.getPagination(req.query),