ra-data-hasura: fix column sorting (#2276)

This commit is contained in:
Pablo Rocha 2019-05-30 02:45:08 -05:00 committed by Shahidh K Muhammed
parent f9fc0cc5e3
commit ec40706121

View File

@ -63,7 +63,7 @@ export default (serverEndpoint, headers, config) => {
finalSelectQuery.args.limit = params.pagination.perPage;
finalSelectQuery.args.offset = (params.pagination.page * params.pagination.perPage) - params.pagination.perPage;
finalSelectQuery.args.where = params.filter;
finalSelectQuery.args.order_by = {column: primaryKey, type: params.sort.order.toLowerCase()};
finalSelectQuery.args.order_by = {column: params.sort.field || primaryKey, type: params.sort.order.toLowerCase()};
finalCountQuery.args.table = {'name': tableName, 'schema': schema};;
finalCountQuery.args.where = {};
finalCountQuery.args.where[primaryKey] = { '$ne': null };
@ -147,7 +147,7 @@ export default (serverEndpoint, headers, config) => {
finalManyQuery.args.limit = params.pagination.perPage;
finalManyQuery.args.offset = (params.pagination.page * params.pagination.perPage) - params.pagination.perPage;
finalManyQuery.args.where = { [params.target]: params.id };
finalManyQuery.args.order_by = {column: primaryKey, type: params.sort.order.toLowerCase()};
finalManyQuery.args.order_by = {column: params.sort.field || primaryKey, type: params.sort.order.toLowerCase()};
finalManyCountQuery.args.table = {'name': tableName, 'schema': schema};;
finalManyCountQuery.args.where = {};
finalManyCountQuery.args.where[primaryKey] = { '$ne': null };