Fix order by (#2646)
* Order by createdAt desc if no sort provided * Fix '0' currency amounts * Code review returns
This commit is contained in:
@ -7,6 +7,11 @@ export const turnSortsIntoOrderByV2 = (
|
||||
fields: Pick<Field, 'id' | 'name'>[],
|
||||
) => {
|
||||
const sortsObject: Record<string, 'AscNullsFirst' | 'DescNullsLast'> = {};
|
||||
if (!sorts.length) {
|
||||
return {
|
||||
createdAt: 'DescNullsFirst',
|
||||
};
|
||||
}
|
||||
sorts.forEach((sort) => {
|
||||
const correspondingField = fields.find(
|
||||
(field) => field.id === sort.fieldMetadataId,
|
||||
|
||||
Reference in New Issue
Block a user