Sort updated on Scenarios

This commit is contained in:
Manuel Romero
2021-03-25 15:53:23 +01:00
parent e12f60516b
commit c3796b478f

View File

@@ -129,9 +129,13 @@ const getPage = async ( model, filter, page, populates, select ) => {
const get = async (model, filter, select, skip, limit, populates, reply) => {
var sort = {};
var modelAttributes = Object.keys(model.schema.tree);
if ( modelAttributes.indexOf("updated") !== -1) {
sort.updated = -1;
if ( model === Scenario ) {
if ( modelAttributes.indexOf("updated") !== -1) {
sort.updated = -1;
}
}
if ( modelAttributes.indexOf("created") !== -1) {
sort.created = -1;
}