@7365admin1/module-hygiene 4.9.0 → 4.10.0

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/dist/index.mjs CHANGED
@@ -2808,6 +2808,22 @@ function useAreaChecklistRepo() {
2808
2808
  preserveNullAndEmptyArrays: true
2809
2809
  }
2810
2810
  },
2811
+ {
2812
+ $addFields: {
2813
+ statusOrder: {
2814
+ $switch: {
2815
+ branches: [
2816
+ { case: { $eq: ["$status", "open"] }, then: 0 },
2817
+ { case: { $eq: ["$status", "ongoing"] }, then: 1 },
2818
+ { case: { $eq: ["$status", "completed"] }, then: 3 },
2819
+ { case: { $eq: ["$status", "closed"] }, then: 4 }
2820
+ ],
2821
+ default: 2
2822
+ }
2823
+ }
2824
+ }
2825
+ },
2826
+ { $sort: { statusOrder: 1, _id: -1 } },
2811
2827
  {
2812
2828
  $project: {
2813
2829
  name: 1,
@@ -2847,7 +2863,6 @@ function useAreaChecklistRepo() {
2847
2863
  createdByName: "$createdByDoc.name"
2848
2864
  }
2849
2865
  },
2850
- { $sort: { _id: -1 } },
2851
2866
  { $skip: page * limit },
2852
2867
  { $limit: limit }
2853
2868
  ];
@@ -3217,6 +3232,7 @@ function useAreaChecklistRepo() {
3217
3232
  name: "$checklist.units.name",
3218
3233
  approve: "$checklist.units.approve",
3219
3234
  reject: "$checklist.units.reject",
3235
+ timestamp: "$checklist.units.timestamp",
3220
3236
  status: {
3221
3237
  $switch: {
3222
3238
  branches: [
@@ -3251,6 +3267,7 @@ function useAreaChecklistRepo() {
3251
3267
  name: "$name",
3252
3268
  approve: "$approve",
3253
3269
  reject: "$reject",
3270
+ timestamp: "$timestamp",
3254
3271
  status: "$status",
3255
3272
  remarks: "$remarks",
3256
3273
  completedByName: "$completedByName"