nestjsx / crud

NestJs CRUD for RESTful APIs
https://github.com/nestjsx/crud/wiki
MIT License
4.04k stars 534 forks source link

adds the postgres nulls support #646

Closed yab94 closed 3 years ago

yab94 commented 3 years ago

Hi,

I made this PR to add a postgresql specific fonctionnality on ORDER BY clauses :

POSTGRESQL DOC : https://www.postgresql.org/docs/8.3/queries-order.html

It allows ORDER BY clauses like :

SELECT field FROM table ORDER BY field ASC NULLS FIRST;

This commit adds to the "QuerySort" type a new optional "nulls" props and concat it to the returned SQL clause.

I set the "nulls" props type to a new QuerySortNullsPriority with NULLS FIRST | NULLS LAST available values.

With this, i can override a getMany inside a service and add the nulls props directly to the CrudRequest sorts entries.