mongo sorts - moved to plugin

This commit is contained in:
Jan Prochazka
2024-08-20 14:00:58 +02:00
parent 49e338bbbc
commit 76c8f8ef62
6 changed files with 45 additions and 23 deletions

View File

@@ -171,7 +171,16 @@ function convertToMongoAggregate(collectionAggregate) {
];
}
function convertToMongoSort(sort) {
if (!sort) return null;
return _zipObject(
sort.map((col) => col.columnName),
sort.map((col) => (col.order == 'DESC' ? -1 : 1))
);
}
module.exports = {
convertToMongoCondition,
convertToMongoAggregate,
convertToMongoSort,
};