exodus-framework 2.0.747 → 2.0.748

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.
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/utils/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,SAAS,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGzE,eAAO,MAAM,SAAS,WAYpB,CAAC;AAEH,eAAO,MAAM,QAAQ,WAYnB,CAAC;AAmDH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,GACnF,YAAY,CAAC,CAAC,CAAC,CA+BjB"}
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/utils/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGzE,eAAO,MAAM,SAAS,WAYpB,CAAC;AAEH,eAAO,MAAM,QAAQ,WAYnB,CAAC;AAgFH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,GACnF,YAAY,CAAC,CAAC,CAAC,CAwCjB"}
@@ -77,6 +77,42 @@ function processCondition(cond) {
77
77
  }
78
78
  return simpleWhere;
79
79
  }
80
+ function processDateCondition(key, cond) {
81
+ const simpleWhere = [key, undefined];
82
+ if (cond.eq !== undefined) {
83
+ simpleWhere[0] = _sequelize.Op.and;
84
+ simpleWhere[1] = [(0, _sequelize.literal)(`DATE(${key}) = '${cond.eq}'`)];
85
+ }
86
+ if (cond.gt !== undefined) {
87
+ simpleWhere[0] = _sequelize.Op.and;
88
+ simpleWhere[1] = [(0, _sequelize.literal)(`DATE(${key}) = '${cond.gt}'`)];
89
+ }
90
+ if (cond.lt !== undefined) {
91
+ simpleWhere[0] = _sequelize.Op.and;
92
+ simpleWhere[1] = [(0, _sequelize.literal)(`DATE(${key}) = '${cond.lt}'`)];
93
+ }
94
+ if (cond.between !== undefined) {
95
+ simpleWhere[1] = {
96
+ [_sequelize.Op.between]: cond.notBetween.map(d => new Date(d))
97
+ };
98
+ }
99
+ if (cond.notBetween !== undefined) {
100
+ simpleWhere[1] = {
101
+ [_sequelize.Op.notBetween]: cond.notBetween.map(d => new Date(d))
102
+ };
103
+ }
104
+ if (cond.in !== undefined) {
105
+ simpleWhere[1] = {
106
+ [_sequelize.Op.in]: cond.notBetween.map(d => new Date(d))
107
+ };
108
+ }
109
+ if (cond.notIn !== undefined) {
110
+ simpleWhere[1] = {
111
+ [_sequelize.Op.notIn]: cond.notBetween.map(d => new Date(d))
112
+ };
113
+ }
114
+ return simpleWhere;
115
+ }
80
116
 
81
117
  // Função Principal para Processar Filtros
82
118
  function processFilters(filters) {
@@ -98,14 +134,22 @@ function processFilters(filters) {
98
134
  where[logicalOp].push(...t);
99
135
  } else {
100
136
  const field = key;
101
- const processedCondition = processCondition(condition);
102
- if (where[field]) {
103
- where[field] = {
104
- ...where[field],
105
- ...processedCondition
106
- };
137
+ const isDate = condition.type && condition.type === 'DATE';
138
+ const isTime = condition.type && condition.type === 'TIME';
139
+ const isDateTime = condition.type && condition.type === 'DATETIME';
140
+ if (isDate) {
141
+ const [k, c] = processDateCondition(key, condition);
142
+ where[k] = c;
107
143
  } else {
108
- where[field] = processedCondition;
144
+ const processedCondition = processCondition(condition);
145
+ if (where[field]) {
146
+ where[field] = {
147
+ ...where[field],
148
+ ...processedCondition
149
+ };
150
+ } else {
151
+ where[field] = processedCondition;
152
+ }
109
153
  }
110
154
  }
111
155
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exodus-framework",
3
- "version": "2.0.747",
3
+ "version": "2.0.748",
4
4
  "description": "Exodus Framework",
5
5
  "author": "jhownpaixao",
6
6
  "license": "ISC",