Browse Source

refactor: apply sort order and set null handling in sort

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/6489/head
Pranav C 1 year ago
parent
commit
27b2134b0c
  1. 17
      packages/nocodb/src/db/BaseModelSqlv2.ts

17
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -580,8 +580,10 @@ ${qb.toQuery()}
}
break;
default:
selectors.push(column.column_name);
groupBySelectors.push(sanitize(column.column_name));
selectors.push(
this.dbDriver.raw('?? as ??', [column.column_name, column.title]),
);
groupBySelectors.push(sanitize(column.title));
break;
}
}),
@ -642,6 +644,8 @@ ${qb.toQuery()}
qb.orderBy(
groupByColumns[sort.fk_column_id].column_name ||
groupByColumns[sort.fk_column_id].title,
sort.direction,
sort.direction === 'desc' ? 'LAST' : 'FIRST',
);
});
@ -736,8 +740,13 @@ ${qb.toQuery()}
}
break;
default:
selectors.push(column.column_name);
groupBySelectors.push(sanitize(column.column_name));
selectors.push(
this.dbDriver.raw('?? as ??', [
column.column_name,
column.title,
]),
);
groupBySelectors.push(sanitize(column.title));
break;
}
}),

Loading…
Cancel
Save