c2-mongoose 2.1.464 → 2.1.466

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.
@@ -15,9 +15,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  var mongoose_1 = require("mongoose");
18
- var BuildConditionFlowItem_1 = __importDefault(require("../../v2/item/BuildConditionFlowItem"));
18
+ var BuildConditionFlowItem_1 = __importDefault(require("../../v3/item/BuildConditionFlowItem"));
19
19
  var BuildConditionSearchTextFlowItem_1 = __importDefault(require("./BuildConditionSearchTextFlowItem"));
20
- var IsValidObjectIdFlowItem_1 = __importDefault(require("../../v2/item/IsValidObjectIdFlowItem"));
20
+ var IsValidObjectIdFlowItem_1 = __importDefault(require("../../v3/item/IsValidObjectIdFlowItem"));
21
21
  var BuildAndQueriesFlowItem = /** @class */ (function () {
22
22
  function BuildAndQueriesFlowItem() {
23
23
  }
@@ -84,6 +84,28 @@ var BuildConditionFlowItem = /** @class */ (function () {
84
84
  key = key.replace("IsEmpty", "");
85
85
  condition[key] = value ? { $size: 0 } : { $not: { $size: 0 } };
86
86
  }
87
+ else if (key.endsWith("Minimum")) {
88
+ key = key.replace("Minimum", "");
89
+ condition[key] = {
90
+ $gte: Number(value)
91
+ };
92
+ }
93
+ else if (key.endsWith("Maximum")) {
94
+ key = key.replace("Maximum", "");
95
+ condition[key] = {
96
+ $lte: Number(value)
97
+ };
98
+ }
99
+ else if (key.endsWith("NotIn")) {
100
+ key = key.replace("NotIn", "");
101
+ var valuesArr = value === null || value === void 0 ? void 0 : value.trim().split(',').map(function (v) { return v.trim(); });
102
+ condition[key] = { $nin: valuesArr };
103
+ }
104
+ else if (key.endsWith("In")) {
105
+ key = key.replace("In", "");
106
+ var valuesArr = value === null || value === void 0 ? void 0 : value.trim().split(',').map(function (v) { return v.trim(); });
107
+ condition[key] = { $in: valuesArr };
108
+ }
87
109
  else {
88
110
  if (((_c = (_b = model === null || model === void 0 ? void 0 : model.schema) === null || _b === void 0 ? void 0 : _b.paths[key]) === null || _c === void 0 ? void 0 : _c.instance) === 'Array') {
89
111
  if (!Array.isArray(value)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.464",
3
+ "version": "2.1.466",
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,7 +1,7 @@
1
1
  import mongoose, { Types } from "mongoose"
2
- import BuildConditionFlowItem from "../../v2/item/BuildConditionFlowItem"
2
+ import BuildConditionFlowItem from "../../v3/item/BuildConditionFlowItem"
3
3
  import BuildConditionSearchTextFlowItem from "./BuildConditionSearchTextFlowItem"
4
- import IsValidObjectIdFlowItem from "../../v2/item/IsValidObjectIdFlowItem"
4
+ import IsValidObjectIdFlowItem from "../../v3/item/IsValidObjectIdFlowItem"
5
5
 
6
6
  class BuildAndQueriesFlowItem {
7
7
  execute(filters: any, model: mongoose.Model<any>) {
@@ -80,6 +80,24 @@ class BuildConditionFlowItem {
80
80
  } else if (key.endsWith("IsEmpty")) {
81
81
  key = key.replace("IsEmpty", "");
82
82
  condition[key] = value ? { $size: 0 } : { $not: { $size: 0 } };
83
+ } else if (key.endsWith("Minimum")) {
84
+ key = key.replace("Minimum", "");
85
+ condition[key] = {
86
+ $gte: Number(value)
87
+ };
88
+ } else if (key.endsWith("Maximum")) {
89
+ key = key.replace("Maximum", "");
90
+ condition[key] = {
91
+ $lte: Number(value)
92
+ };
93
+ } else if (key.endsWith("NotIn")) {
94
+ key = key.replace("NotIn", "");
95
+ var valuesArr = value?.trim().split(',').map((v: string) => v.trim());
96
+ condition[key] = { $nin: valuesArr };
97
+ } else if (key.endsWith("In")) {
98
+ key = key.replace("In", "");
99
+ var valuesArr = value?.trim().split(',').map((v: string) => v.trim());
100
+ condition[key] = { $in: valuesArr };
83
101
  } else {
84
102
  if (model?.schema?.paths[key]?.instance === 'Array') {
85
103
  if (!Array.isArray(value)) {