@eeplatform/basic-edu 1.3.6 → 1.3.7

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @eeplatform/basic-edu
2
2
 
3
+ ## 1.3.7
4
+
5
+ ### Patch Changes
6
+
7
+ - cdddd66: Revise getAll(), remove default sort
8
+
3
9
  ## 1.3.6
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -4573,7 +4573,7 @@ function useSchoolRepo() {
4573
4573
  deletedAt: { $in: ["", null] },
4574
4574
  status
4575
4575
  };
4576
- sort = Object.keys(sort).length > 0 ? sort : { _id: 1 };
4576
+ sort = Object.keys(sort).length > 0 ? sort : {};
4577
4577
  const cacheKeyOptions = {
4578
4578
  status,
4579
4579
  page,
@@ -4602,12 +4602,12 @@ function useSchoolRepo() {
4602
4602
  });
4603
4603
  return cached;
4604
4604
  }
4605
- const items = await collection.aggregate([
4606
- { $match: query },
4607
- { $sort: sort },
4608
- { $skip: page * limit },
4609
- { $limit: limit }
4610
- ]).toArray();
4605
+ const pipeline = [{ $match: query }];
4606
+ if (Object.keys(sort).length > 0) {
4607
+ pipeline.push({ $sort: sort });
4608
+ }
4609
+ pipeline.push({ $skip: page * limit }, { $limit: limit });
4610
+ const items = await collection.aggregate(pipeline).toArray();
4611
4611
  const length = await collection.countDocuments(query);
4612
4612
  const data = (0, import_nodejs_utils17.paginate)(items, page, limit, length);
4613
4613
  setCache(cacheKey, data, 600).then(() => {