evoluteur / evolutility-server-node

Model-driven REST APIs for CRUD and more, written in Javascript, using Node.js, Express, and PostgreSQL.
GNU Affero General Public License v3.0
112 stars 33 forks source link

Collection API sorts in wrong order #13

Closed david-pfx closed 5 years ago

david-pfx commented 5 years ago

The collection API function uses this SQL:

    sql = 'SELECT t1.id, '+sqls.select(collec.fields)+
         ' FROM '+schema+'."'+collec.table+'" AS t1'+
         ' WHERE t1."'+collec.column+'"=$1'+
         ' ORDER BY t1.id'+//t1.position, t1.id
         ' LIMIT '+defaultPageSize+';';

The ORDER BY on t1.id looks incorrect. See the collections panel for 'Vine Cliff' for an example. It looks like it should be `collec.fields[0].id', or something like that.

Note: there doesn't seem to be any way to sort collections to a desired order.

evoluteur commented 5 years ago

Thanks. Fixed.