identity-admin 1.24.1 → 1.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -502,20 +502,21 @@ let DashboardController = DashboardController_1 = class DashboardController {
502
502
  record = yield ResourceHelper_1.default.addExtraFields(modifiedResource.showProperties, modifiedResource.properties.model, record, StringUtils_1.default.lowerCaseFirstLetter(modifiedResource.properties.modelName), resource);
503
503
  const sortBy = modifiedResource.properties
504
504
  .defaultOrderBy;
505
+ const sort = modifiedResource.properties.defaultOrder;
505
506
  const nextQuery = {};
506
507
  const prevQuery = {};
507
- const nextSortQuery = {};
508
- const prevSortQuery = {};
509
- nextQuery[sortBy] = { $gt: record[sortBy] };
510
- prevQuery[sortBy] = { $lt: record[sortBy] };
511
- nextSortQuery[sortBy] = 1;
512
- prevSortQuery[sortBy] = -1;
508
+ const sortQuery = {};
509
+ const greaterThanQuery = { $gt: record[sortBy] };
510
+ const lessThanQuery = { $lt: record[sortBy] };
511
+ nextQuery[sortBy] = sort === 'asc' ? greaterThanQuery : lessThanQuery;
512
+ prevQuery[sortBy] = sort === 'asc' ? lessThanQuery : greaterThanQuery;
513
+ sortQuery[sortBy] = sort;
513
514
  var neighbor;
514
515
  if (neighborRecordType === helpers_1.NeighborTypes.NEXT) {
515
- neighbor = yield (model === null || model === void 0 ? void 0 : model.findOne(nextQuery).sort(nextSortQuery).limit(1));
516
+ neighbor = yield (model === null || model === void 0 ? void 0 : model.findOne(nextQuery).sort(sortQuery).limit(1));
516
517
  }
517
518
  else {
518
- neighbor = yield (model === null || model === void 0 ? void 0 : model.findOne(prevQuery).sort(prevSortQuery).limit(1));
519
+ neighbor = yield (model === null || model === void 0 ? void 0 : model.findOne(prevQuery).sort(sortQuery).limit(1));
519
520
  }
520
521
  const hasNeighbor = record && neighbor && neighbor._id ? true : false;
521
522
  const neighborRecordId = hasNeighbor ? neighbor._id : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "identity-admin",
3
- "version": "1.24.1",
3
+ "version": "1.24.2",
4
4
  "description": "",
5
5
  "main": "lib/Dashboard.js",
6
6
  "types": "lib/Dashbord.d.ts",