c2-mongoose 2.1.9 → 2.1.10
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/CrudFlow.d.ts +1 -0
- package/dist/flow/CrudFlow.js +10 -0
- package/package.json +1 -1
- package/src/flow/CrudFlow.ts +4 -0
package/dist/flow/CrudFlow.d.ts
CHANGED
|
@@ -13,5 +13,6 @@ declare class CrudFlow<D> {
|
|
|
13
13
|
find(): Promise<SearchResponse<D>>;
|
|
14
14
|
getOne(model: D, params?: any): Promise<D>;
|
|
15
15
|
get(id: string, pop?: string, sel?: string, session?: ClientSession): Promise<D>;
|
|
16
|
+
sumBy(fieldToSum: string, fieldToGroup: string): Promise<any>;
|
|
16
17
|
}
|
|
17
18
|
export default CrudFlow;
|
package/dist/flow/CrudFlow.js
CHANGED
|
@@ -134,6 +134,16 @@ var CrudFlow = /** @class */ (function () {
|
|
|
134
134
|
});
|
|
135
135
|
});
|
|
136
136
|
};
|
|
137
|
+
CrudFlow.prototype.sumBy = function (fieldToSum, fieldToGroup) {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
139
|
+
return __generator(this, function (_a) {
|
|
140
|
+
switch (_a.label) {
|
|
141
|
+
case 0: return [4 /*yield*/, this.search.sumBy(this.repository, fieldToSum, fieldToGroup)];
|
|
142
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
};
|
|
137
147
|
return CrudFlow;
|
|
138
148
|
}());
|
|
139
149
|
exports.default = CrudFlow;
|
package/package.json
CHANGED
package/src/flow/CrudFlow.ts
CHANGED
|
@@ -46,6 +46,10 @@ class CrudFlow<D> {
|
|
|
46
46
|
const data = await this.repository.findById(id).populate(pop).select(sel).session(session!)
|
|
47
47
|
return data as D
|
|
48
48
|
}
|
|
49
|
+
|
|
50
|
+
public async sumBy(fieldToSum: string, fieldToGroup: string): Promise<any> {
|
|
51
|
+
return await this.search.sumBy(this.repository, fieldToSum, fieldToGroup)
|
|
52
|
+
}
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
export default CrudFlow
|