c2-mongoose 2.1.133 → 2.1.134

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.
@@ -1,9 +1,14 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ var GetCamellCaseStringFlowItem_1 = __importDefault(require("./GetCamellCaseStringFlowItem"));
3
7
  var BuildPipelineToCountJoinFlowItem = /** @class */ (function () {
4
8
  function BuildPipelineToCountJoinFlowItem() {
5
9
  }
6
10
  BuildPipelineToCountJoinFlowItem.prototype.build = function (joinWith, fieldTarget) {
11
+ var _a;
7
12
  return [
8
13
  {
9
14
  $lookup: {
@@ -23,9 +28,9 @@ var BuildPipelineToCountJoinFlowItem = /** @class */ (function () {
23
28
  }
24
29
  },
25
30
  {
26
- $addFields: {
27
- totalProducts: { $ifNull: [{ $arrayElemAt: ['$matchedDocuments.totalCount', 0] }, 0] }
28
- }
31
+ $addFields: (_a = {},
32
+ _a["total".concat(GetCamellCaseStringFlowItem_1.default.get(joinWith.collection.name))] = { $ifNull: [{ $arrayElemAt: ['$matchedDocuments.totalCount', 0] }, 0] },
33
+ _a)
29
34
  },
30
35
  {
31
36
  $project: {
@@ -0,0 +1,5 @@
1
+ declare class GetCamellCaseStringFlowItem {
2
+ get(input: string): string;
3
+ }
4
+ declare const _default: GetCamellCaseStringFlowItem;
5
+ export default _default;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var GetCamellCaseStringFlowItem = /** @class */ (function () {
4
+ function GetCamellCaseStringFlowItem() {
5
+ }
6
+ GetCamellCaseStringFlowItem.prototype.get = function (input) {
7
+ return input.charAt(0).toUpperCase() + input.slice(1);
8
+ };
9
+ return GetCamellCaseStringFlowItem;
10
+ }());
11
+ exports.default = new GetCamellCaseStringFlowItem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.133",
3
+ "version": "2.1.134",
4
4
  "description": "Lib to make any search in database mongoose and use as basic crud",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,4 +1,5 @@
1
1
  import mongoose from "mongoose"
2
+ import GetCamellCaseStringFlowItem from "./GetCamellCaseStringFlowItem"
2
3
 
3
4
  class BuildPipelineToCountJoinFlowItem {
4
5
  build(joinWith: mongoose.Model<any>, fieldTarget: string): any[] {
@@ -22,7 +23,7 @@ class BuildPipelineToCountJoinFlowItem {
22
23
  },
23
24
  {
24
25
  $addFields: {
25
- totalProducts: { $ifNull: [{ $arrayElemAt: ['$matchedDocuments.totalCount', 0] }, 0] }
26
+ [`total${GetCamellCaseStringFlowItem.get(joinWith.collection.name)}`]: { $ifNull: [{ $arrayElemAt: ['$matchedDocuments.totalCount', 0] }, 0] }
26
27
  }
27
28
  },
28
29
  {
@@ -0,0 +1,7 @@
1
+ class GetCamellCaseStringFlowItem {
2
+ get(input: string): string {
3
+ return input.charAt(0).toUpperCase() + input.slice(1);
4
+ }
5
+ }
6
+
7
+ export default new GetCamellCaseStringFlowItem