c2-mongoose 2.1.441 → 2.1.443
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/flow/searcher/v3/item/GroupV3FlowItem.js +1 -1
- package/dist/flow/searcher/v3/item/SortV3FlowItem.d.ts +1 -1
- package/dist/flow/searcher/v3/item/SortV3FlowItem.js +6 -8
- package/package.json +1 -1
- package/src/flow/searcher/v3/item/GroupV3FlowItem.ts +1 -1
- package/src/flow/searcher/v3/item/SortV3FlowItem.ts +9 -9
|
@@ -76,7 +76,7 @@ var GroupV3FlowItem = /** @class */ (function () {
|
|
|
76
76
|
groupsClauses.push(projectClause);
|
|
77
77
|
if (detailed && (filters === null || filters === void 0 ? void 0 : filters.orderBy)) {
|
|
78
78
|
var orderBy = Array.isArray(filters.orderBy) ? filters.orderBy : [filters.orderBy];
|
|
79
|
-
var docOrderBy = orderBy.filter(function (o) { return typeof o === 'string' && o.startsWith('
|
|
79
|
+
var docOrderBy = orderBy.filter(function (o) { return typeof o === 'string' && o.startsWith('docs.'); });
|
|
80
80
|
var sortByFields = {};
|
|
81
81
|
for (var _i = 0, docOrderBy_1 = docOrderBy; _i < docOrderBy_1.length; _i++) {
|
|
82
82
|
var o = docOrderBy_1[_i];
|
|
@@ -4,16 +4,14 @@ var SortV3FlowItem = /** @class */ (function () {
|
|
|
4
4
|
function SortV3FlowItem() {
|
|
5
5
|
}
|
|
6
6
|
SortV3FlowItem.prototype.execute = function (orderBy, orderSense) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return _a = {},
|
|
11
|
-
_a[order] = orderSense === "desc" ? -1 : 1,
|
|
12
|
-
_a;
|
|
13
|
-
});
|
|
7
|
+
var ordenation = orderBy.split(',').map(function (field) { return field.trim(); });
|
|
8
|
+
if (!ordenation.length) {
|
|
9
|
+
return [{ $sort: { _id: orderSense === "desc" ? -1 : 1 } }];
|
|
14
10
|
}
|
|
15
11
|
var sort = {};
|
|
16
|
-
|
|
12
|
+
ordenation.forEach(function (order) {
|
|
13
|
+
sort[order] = orderSense === "desc" ? -1 : 1;
|
|
14
|
+
});
|
|
17
15
|
return [{ $sort: sort }];
|
|
18
16
|
};
|
|
19
17
|
return SortV3FlowItem;
|
package/package.json
CHANGED
|
@@ -81,7 +81,7 @@ class GroupV3FlowItem {
|
|
|
81
81
|
|
|
82
82
|
if (detailed && filters?.orderBy) {
|
|
83
83
|
const orderBy = Array.isArray(filters.orderBy) ? filters.orderBy : [filters.orderBy]
|
|
84
|
-
const docOrderBy = orderBy.filter((o: string) => typeof o === 'string' && o.startsWith('
|
|
84
|
+
const docOrderBy = orderBy.filter((o: string) => typeof o === 'string' && o.startsWith('docs.'))
|
|
85
85
|
const sortByFields: Record<string, 1 | -1> = {}
|
|
86
86
|
for (const o of docOrderBy) {
|
|
87
87
|
sortByFields[o.replace(/^doc\./, '')] = filters.orderSense === 'desc' ? -1 : 1
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
class SortV3FlowItem {
|
|
2
|
-
execute(orderBy: string
|
|
2
|
+
execute(orderBy: string, orderSense: string): any[] {
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
})
|
|
4
|
+
const ordenation = orderBy.split(',').map((field: string) => field.trim())
|
|
5
|
+
|
|
6
|
+
if (!ordenation.length) {
|
|
7
|
+
return [{ $sort: { _id: orderSense === "desc" ? -1 : 1 } }]
|
|
10
8
|
}
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const sort = {} as any
|
|
11
|
+
ordenation.forEach((order: string) => {
|
|
12
|
+
sort[order] = orderSense === "desc" ? -1 : 1
|
|
13
|
+
})
|
|
14
14
|
return [{ $sort: sort }]
|
|
15
15
|
}
|
|
16
16
|
}
|