We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 249d157 commit d5d9d93Copy full SHA for d5d9d93
src/core/database/query/sorting.ts
@@ -67,7 +67,12 @@ export const sortWith = <Field extends string>(
67
query.comment`sorting(${input.sort})`
68
.subQuery('*', (sub) => matcher(sub, subInput))
69
.with('*')
70
- .orderBy(`${transformerRef.current('sortValue')}`, order);
+ .apply((query) => {
71
+ const val = String(transformerRef.current('sortValue'));
72
+ return order === 'ASC'
73
+ ? query.orderBy(val)
74
+ : query.orderBy([`${val} IS NOT NULL`, val], order);
75
+ });
76
};
77
78
/**
0 commit comments