c2-mongoose 2.1.228 → 2.1.229
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.
|
@@ -100,7 +100,7 @@ var SearcherFlow = /** @class */ (function () {
|
|
|
100
100
|
if ((0, Utils_1.isNotEmpty)(this.select)) {
|
|
101
101
|
stagesItems.push({ $project: BuildSelectSingleFlowItem_1.default.build(model, this.select) });
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
stagesItems.push({ $sort: this.buildOrdenation() });
|
|
104
104
|
if (this.pageable === true) {
|
|
105
105
|
stagesItems.push({ $skip: ((this.page - 1) * this.limit) || 0 });
|
|
106
106
|
stagesItems.push({ $limit: this.limit });
|
|
@@ -284,6 +284,12 @@ var SearcherFlow = /** @class */ (function () {
|
|
|
284
284
|
var objectIdPattern = /^[0-9a-fA-F]{24}$/;
|
|
285
285
|
return objectIdPattern.test(value);
|
|
286
286
|
};
|
|
287
|
+
SearcherFlow.prototype.buildOrdenation = function () {
|
|
288
|
+
var order = {};
|
|
289
|
+
this.orderBy = this.orderBy;
|
|
290
|
+
order[this.orderBy] = this.orderSense === "desc" ? -1 : 1;
|
|
291
|
+
return order;
|
|
292
|
+
};
|
|
287
293
|
return SearcherFlow;
|
|
288
294
|
}());
|
|
289
295
|
exports.default = SearcherFlow;
|
package/package.json
CHANGED
package/src/flow/SearcherFlow.ts
CHANGED
|
@@ -66,7 +66,7 @@ class SearcherFlow<D> {
|
|
|
66
66
|
stagesItems.push({ $project: BuildSelectSingleFlowItem.build(model, this.select) })
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
stagesItems.push({ $sort: this.buildOrdenation() })
|
|
70
70
|
if (this.pageable === true) {
|
|
71
71
|
stagesItems.push({ $skip: ((this.page - 1) * this.limit) || 0 })
|
|
72
72
|
stagesItems.push({ $limit: this.limit })
|
|
@@ -268,6 +268,13 @@ class SearcherFlow<D> {
|
|
|
268
268
|
const objectIdPattern = /^[0-9a-fA-F]{24}$/;
|
|
269
269
|
return objectIdPattern.test(value);
|
|
270
270
|
}
|
|
271
|
+
|
|
272
|
+
public buildOrdenation() {
|
|
273
|
+
let order = {} as any
|
|
274
|
+
this.orderBy = this.orderBy
|
|
275
|
+
order[this.orderBy] = this.orderSense === "desc" ? -1 : 1
|
|
276
|
+
return order
|
|
277
|
+
}
|
|
271
278
|
}
|
|
272
279
|
|
|
273
280
|
export default SearcherFlow
|