c2-mongoose 2.1.26 → 2.1.28

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.
@@ -84,7 +84,7 @@ var SearchFlow = /** @class */ (function () {
84
84
  this.populate = params.populate;
85
85
  this.page = Number(params.page || 1);
86
86
  this.limit = Number(params.limit || 25);
87
- this.pageable = params.pageable == undefined ? true : params.pageable;
87
+ this.pageable = params.pageable == false ? false : true;
88
88
  this.buildPopulate();
89
89
  }
90
90
  SearchFlow.prototype.buildPopulate = function () {
@@ -133,7 +133,7 @@ var SearchFlow = /** @class */ (function () {
133
133
  return __generator(this, function (_a) {
134
134
  switch (_a.label) {
135
135
  case 0:
136
- if (!this.pageable) return [3 /*break*/, 2];
136
+ if (!(this.pageable == true)) return [3 /*break*/, 2];
137
137
  return [4 /*yield*/, this.searchPageable(model)];
138
138
  case 1: return [2 /*return*/, _a.sent()];
139
139
  case 2: return [4 /*yield*/, this.searchNoPageable(model)];
@@ -153,7 +153,6 @@ var SearchFlow = /** @class */ (function () {
153
153
  .find(this.filters, this.select)
154
154
  .populate(this.populate)
155
155
  .sort(sort)
156
- .limit(this.limit)
157
156
  .collation({
158
157
  locale: Environment_1.dbCollation || "pt"
159
158
  })];
@@ -172,7 +171,7 @@ var SearchFlow = /** @class */ (function () {
172
171
  case 0:
173
172
  searchResponse = {};
174
173
  searchResponse.items = items;
175
- if (!this.pageable) return [3 /*break*/, 2];
174
+ if (!(this.pageable == true)) return [3 /*break*/, 2];
176
175
  return [4 /*yield*/, this.count(model)];
177
176
  case 1:
178
177
  total = _a.sent();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.26",
3
+ "version": "2.1.28",
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",
@@ -57,6 +57,7 @@ class CrudFlow<D> {
57
57
  if (isEmpty(this.search)) {
58
58
  throw new Error("Search params not informed")
59
59
  }
60
+
60
61
  const data = await this.repository.findById(id)
61
62
  .populate(this.search.populate)
62
63
  .select(this.search.select)
@@ -23,7 +23,7 @@ abstract class SearchFlow {
23
23
  this.populate = params.populate
24
24
  this.page = Number(params.page || 1)
25
25
  this.limit = Number(params.limit || 25)
26
- this.pageable = params.pageable == undefined ? true : params.pageable
26
+ this.pageable = params.pageable == false ? false : true
27
27
  this.buildPopulate()
28
28
  }
29
29
 
@@ -72,7 +72,7 @@ abstract class SearchFlow {
72
72
  }
73
73
 
74
74
  public async search(model: mongoose.Model<any>): Promise<SearchResponse<any>> {
75
- if (this.pageable) {
75
+ if (this.pageable == true) {
76
76
  return await this.searchPageable(model)
77
77
  }
78
78
 
@@ -100,7 +100,6 @@ abstract class SearchFlow {
100
100
  .find(this.filters, this.select)
101
101
  .populate(this.populate)
102
102
  .sort(sort)
103
- .limit(this.limit)
104
103
  .collation({
105
104
  locale: dbCollation || "pt"
106
105
  }) as []
@@ -112,7 +111,7 @@ abstract class SearchFlow {
112
111
  var searchResponse: SearchResponse<any> = {}
113
112
  searchResponse.items = items
114
113
 
115
- if (this.pageable) {
114
+ if (this.pageable == true) {
116
115
  var total = await this.count(model)
117
116
  var paging: Pagination = {}
118
117
  paging.total = total