c2-mongoose 2.1.269 → 2.1.270

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.
@@ -10,6 +10,7 @@ declare class SearcherFlow<D> {
10
10
  model: mongoose.Model<any>;
11
11
  [key: string]: any;
12
12
  searchText: string;
13
+ searchTextFields: string[];
13
14
  orderSense: string;
14
15
  orderBy: string;
15
16
  page: number;
@@ -67,6 +67,7 @@ var BuildSelectSingleFlowItem_1 = __importDefault(require("./item/BuildSelectSin
67
67
  var SearcherFlow = /** @class */ (function () {
68
68
  function SearcherFlow(repository) {
69
69
  this.searchText = "";
70
+ this.searchTextFields = [];
70
71
  this.orderSense = "desc";
71
72
  this.orderBy = "_id";
72
73
  this.page = 1;
@@ -213,7 +214,7 @@ var SearcherFlow = /** @class */ (function () {
213
214
  SearcherFlow.prototype.buildDefaultFilters = function (objectSearch) {
214
215
  var _this = this;
215
216
  // Recuperar todos os campos do tipo String
216
- var camposString = this.extractFieldsOfType(this.model.schema, 'String');
217
+ var camposString = (0, Utils_1.isEmpty)(this.searchTextFields) ? this.extractFieldsOfType(this.model.schema, 'String') : this.searchTextFields;
217
218
  var filters = { $and: [] };
218
219
  Object.entries(objectSearch).forEach(function (_a) {
219
220
  var _b, _c, _d;
@@ -235,6 +236,7 @@ var SearcherFlow = /** @class */ (function () {
235
236
  'model',
236
237
  'select',
237
238
  'searchText',
239
+ 'searchTextFields',
238
240
  'sort',
239
241
  'isPageable',
240
242
  'searchPageable'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.269",
3
+ "version": "2.1.270",
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",
@@ -17,6 +17,7 @@ class SearcherFlow<D> {
17
17
 
18
18
  [key: string]: any
19
19
  public searchText: string = ""
20
+ public searchTextFields: string[] = []
20
21
  public orderSense: string = "desc"
21
22
  public orderBy: string = "_id"
22
23
  public page: number = 1
@@ -175,7 +176,7 @@ class SearcherFlow<D> {
175
176
  public buildDefaultFilters(objectSearch: any) {
176
177
 
177
178
  // Recuperar todos os campos do tipo String
178
- const camposString = this.extractFieldsOfType(this.model.schema, 'String')
179
+ const camposString = isEmpty(this.searchTextFields) ? this.extractFieldsOfType(this.model.schema, 'String') : this.searchTextFields
179
180
 
180
181
 
181
182
  let filters = { $and: [] } as any
@@ -197,6 +198,7 @@ class SearcherFlow<D> {
197
198
  'model',
198
199
  'select',
199
200
  'searchText',
201
+ 'searchTextFields',
200
202
  'sort',
201
203
  'isPageable',
202
204
  'searchPageable'].includes(key)) {