c2-mongoose 2.1.26 → 2.1.27

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 == true ? true : false;
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)];
@@ -172,7 +172,7 @@ var SearchFlow = /** @class */ (function () {
172
172
  case 0:
173
173
  searchResponse = {};
174
174
  searchResponse.items = items;
175
- if (!this.pageable) return [3 /*break*/, 2];
175
+ if (!(this.pageable == true)) return [3 /*break*/, 2];
176
176
  return [4 /*yield*/, this.count(model)];
177
177
  case 1:
178
178
  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.27",
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 == true ? true : false
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
 
@@ -112,7 +112,7 @@ abstract class SearchFlow {
112
112
  var searchResponse: SearchResponse<any> = {}
113
113
  searchResponse.items = items
114
114
 
115
- if (this.pageable) {
115
+ if (this.pageable == true) {
116
116
  var total = await this.count(model)
117
117
  var paging: Pagination = {}
118
118
  paging.total = total