c2-mongoose 2.1.217 → 2.1.218

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.
@@ -18,6 +18,7 @@ declare class SearcherFlow<D> {
18
18
  private pageable;
19
19
  private selection;
20
20
  private populate;
21
+ private filters;
21
22
  constructor(repository: mongoose.Model<any>, search?: SearchFlow);
22
23
  prepareSearch(search: any): void;
23
24
  search(model: mongoose.Model<any>, options: SearchOptions): Promise<SearchResponse<D>>;
@@ -65,6 +65,7 @@ var SearcherFlow = /** @class */ (function () {
65
65
  this.pageable = true;
66
66
  this.selection = [""];
67
67
  this.populate = [""];
68
+ this.filters = undefined;
68
69
  this.model = repository;
69
70
  for (var key in search) {
70
71
  this[key] = search[key];
@@ -74,6 +75,7 @@ var SearcherFlow = /** @class */ (function () {
74
75
  for (var key in search) {
75
76
  this[key] = search[key];
76
77
  }
78
+ this.filters = this.buildDefaultFilters(this);
77
79
  // this.projection = this.buildProjections()
78
80
  // this.populate = this.buildPopulate()
79
81
  // this.buildOrdenation()
@@ -84,6 +86,7 @@ var SearcherFlow = /** @class */ (function () {
84
86
  return __generator(this, function (_b) {
85
87
  switch (_b.label) {
86
88
  case 0:
89
+ console.log("new searcher");
87
90
  stagesItems = [];
88
91
  if ((0, Utils_1.isNotEmpty)(options.pipelines)) {
89
92
  stagesItems.push.apply(stagesItems, options.pipelines);
@@ -93,7 +96,7 @@ var SearcherFlow = /** @class */ (function () {
93
96
  }
94
97
  stagesItems.push({ $match: this.filters });
95
98
  if ((0, Utils_1.isNotEmpty)(this.projection)) {
96
- stagesItems.push({ $project: BuildSelectSingleFlowItem_1.default.build(model, this.select) });
99
+ stagesItems.push({ $project: BuildSelectSingleFlowItem_1.default.build(model, this.selection) });
97
100
  }
98
101
  // stagesItems.push({ $sort: this.sort })
99
102
  if (this.pageable === true) {
@@ -198,7 +201,7 @@ var SearcherFlow = /** @class */ (function () {
198
201
  'page',
199
202
  'limit',
200
203
  'model',
201
- 'select',
204
+ 'selection',
202
205
  'searchText',
203
206
  'sort',
204
207
  'isPageable',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.217",
3
+ "version": "2.1.218",
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",
@@ -26,6 +26,7 @@ class SearcherFlow<D> {
26
26
 
27
27
  private selection: string[] = [""]
28
28
  private populate: string[] = [""]
29
+ private filters: any = undefined
29
30
 
30
31
  constructor(repository: mongoose.Model<any>, search?: SearchFlow) {
31
32
  this.model = repository
@@ -39,6 +40,8 @@ class SearcherFlow<D> {
39
40
  this[key] = search[key];
40
41
  }
41
42
 
43
+ this.filters = this.buildDefaultFilters(this)
44
+
42
45
  // this.projection = this.buildProjections()
43
46
  // this.populate = this.buildPopulate()
44
47
  // this.buildOrdenation()
@@ -46,6 +49,7 @@ class SearcherFlow<D> {
46
49
 
47
50
  async search(model: mongoose.Model<any>, options: SearchOptions): Promise<SearchResponse<D>> {
48
51
 
52
+ console.log("new searcher")
49
53
  let stagesItems: any[] = []
50
54
 
51
55
  if (isNotEmpty(options.pipelines)) {
@@ -58,7 +62,7 @@ class SearcherFlow<D> {
58
62
  stagesItems.push({ $match: this.filters })
59
63
 
60
64
  if (isNotEmpty(this.projection)) {
61
- stagesItems.push({ $project: BuildSelectSingleFlowItem.build(model, this.select) })
65
+ stagesItems.push({ $project: BuildSelectSingleFlowItem.build(model, this.selection) })
62
66
  }
63
67
 
64
68
  // stagesItems.push({ $sort: this.sort })
@@ -171,7 +175,7 @@ class SearcherFlow<D> {
171
175
  'page',
172
176
  'limit',
173
177
  'model',
174
- 'select',
178
+ 'selection',
175
179
  'searchText',
176
180
  'sort',
177
181
  'isPageable',