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

@@ -238,15 +238,16 @@ export class PerspectiveDataLoader {
const res: any = {
pureName,
condition: this.buildSqlCondition(props),
sort: useSort ? props.orderBy : undefined,
skip: props.range?.offset,
limit: props.range?.limit,
};
if (useSort && props.orderBy?.length > 0) {
res.sort = _zipObject(
props.orderBy.map(col => col.columnName),
props.orderBy.map(col => (col.order == 'DESC' ? -1 : 1))
);
}
// if (useSort && props.orderBy?.length > 0) {
// res.sort = _zipObject(
// props.orderBy.map(col => col.columnName),
// props.orderBy.map(col => (col.order == 'DESC' ? -1 : 1))
// );
// }
return res;
}