c2-mongoose 2.1.193 → 2.1.195
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.
- package/dist/flow/C2Flow.js +6 -0
- package/dist/flow/SearchFlow.js +4 -3
- package/package.json +2 -1
- package/src/flow/C2Flow.ts +7 -0
- package/src/flow/SearchFlow.ts +4 -3
package/dist/flow/C2Flow.js
CHANGED
|
@@ -111,6 +111,9 @@ var C2Flow = /** @class */ (function () {
|
|
|
111
111
|
}
|
|
112
112
|
return [2 /*return*/, dataAfter._doc];
|
|
113
113
|
}
|
|
114
|
+
if ((0, Utils_1.isEmpty)(dataAfter)) {
|
|
115
|
+
return [2 /*return*/, dataAfter];
|
|
116
|
+
}
|
|
114
117
|
log = BuildLogFlowItem_1.default.build(options, __assign({ _id: _id }, data), Logger_1.TypeOfOperation.UPDATE, this.repository);
|
|
115
118
|
return [4 /*yield*/, global.LoggerRepository.create([log], { session: options.session })];
|
|
116
119
|
case 2:
|
|
@@ -137,6 +140,9 @@ var C2Flow = /** @class */ (function () {
|
|
|
137
140
|
}
|
|
138
141
|
return [2 /*return*/, dataAfter._doc];
|
|
139
142
|
}
|
|
143
|
+
if ((0, Utils_1.isEmpty)(dataAfter)) {
|
|
144
|
+
return [2 /*return*/, dataAfter];
|
|
145
|
+
}
|
|
140
146
|
log = BuildLogFlowItem_1.default.build(options, __assign({ _id: dataAfter._id }, data), Logger_1.TypeOfOperation.UPDATE, this.repository);
|
|
141
147
|
return [4 /*yield*/, global.LoggerRepository.create([log], { session: options.session })];
|
|
142
148
|
case 2:
|
package/dist/flow/SearchFlow.js
CHANGED
|
@@ -50,9 +50,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
|
|
53
|
+
// import moment from "moment"
|
|
54
54
|
var mongoose_1 = require("mongoose");
|
|
55
55
|
var Utils_1 = require("../utils/Utils");
|
|
56
|
+
var moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
56
57
|
var SearchFlow = /** @class */ (function () {
|
|
57
58
|
function SearchFlow(params) {
|
|
58
59
|
// Incluir as propriedades adicionais de 'params' como propriedades da classe
|
|
@@ -478,14 +479,14 @@ var SearchFlow = /** @class */ (function () {
|
|
|
478
479
|
var fieldName = key.replace('Range', '');
|
|
479
480
|
var values = value;
|
|
480
481
|
if ((0, Utils_1.isNotEmpty)(values[0])) {
|
|
481
|
-
var momentValue = (0,
|
|
482
|
+
var momentValue = (0, moment_timezone_1.default)(values[0]).tz('America/Sao_Paulo', false);
|
|
482
483
|
momentValue.hour(0);
|
|
483
484
|
momentValue.minute(0);
|
|
484
485
|
momentValue.second(0);
|
|
485
486
|
condition[fieldName] = __assign(__assign({}, condition[fieldName]), { $gte: momentValue.toDate() });
|
|
486
487
|
}
|
|
487
488
|
if ((0, Utils_1.isNotEmpty)(values[1])) {
|
|
488
|
-
var momentValue = (0,
|
|
489
|
+
var momentValue = (0, moment_timezone_1.default)(values[1]).tz('America/Sao_Paulo', false);
|
|
489
490
|
momentValue.hour(23);
|
|
490
491
|
momentValue.minute(59);
|
|
491
492
|
momentValue.second(59);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c2-mongoose",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.195",
|
|
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",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"dotenv": "^16.0.3",
|
|
32
32
|
"express-http-context": "^1.2.4",
|
|
33
33
|
"moment": "^2.29.4",
|
|
34
|
+
"moment-timezone": "^0.5.43",
|
|
34
35
|
"mongoose": "^7.0.1"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
package/src/flow/C2Flow.ts
CHANGED
|
@@ -49,6 +49,9 @@ class C2Flow<D> {
|
|
|
49
49
|
}
|
|
50
50
|
return dataAfter._doc
|
|
51
51
|
}
|
|
52
|
+
if (isEmpty(dataAfter)) {
|
|
53
|
+
return dataAfter
|
|
54
|
+
}
|
|
52
55
|
|
|
53
56
|
let log: Partial<ILogger> = BuildLogFlowItem.build(options, { _id, ...data }, TypeOfOperation.UPDATE, this.repository)
|
|
54
57
|
await (global as any).LoggerRepository.create([log], { session: options.session })
|
|
@@ -68,6 +71,10 @@ class C2Flow<D> {
|
|
|
68
71
|
return dataAfter._doc
|
|
69
72
|
}
|
|
70
73
|
|
|
74
|
+
if (isEmpty(dataAfter)) {
|
|
75
|
+
return dataAfter
|
|
76
|
+
}
|
|
77
|
+
|
|
71
78
|
let log: Partial<ILogger> = BuildLogFlowItem.build(options, { _id: dataAfter._id, ...data }, TypeOfOperation.UPDATE, this.repository)
|
|
72
79
|
await (global as any).LoggerRepository.create([log], { session: options.session })
|
|
73
80
|
if (isEmpty(dataAfter)) {
|
package/src/flow/SearchFlow.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import moment from "moment"
|
|
1
|
+
// import moment from "moment"
|
|
2
2
|
import mongoose, { ClientSession, Types } from "mongoose"
|
|
3
3
|
import { SearchOptions, SearchResponse } from "../types/SearchResponse"
|
|
4
4
|
import { isEmpty, isNotEmpty } from "../utils/Utils"
|
|
5
|
+
import moment from "moment-timezone"
|
|
5
6
|
|
|
6
7
|
abstract class SearchFlow {
|
|
7
8
|
[key: string]: any
|
|
@@ -422,7 +423,7 @@ abstract class SearchFlow {
|
|
|
422
423
|
var fieldName = key.replace('Range', '')
|
|
423
424
|
var values = value as any
|
|
424
425
|
if (isNotEmpty(values[0])) {
|
|
425
|
-
var momentValue = moment(values[0])
|
|
426
|
+
var momentValue = moment(values[0]).tz('America/Sao_Paulo', false)
|
|
426
427
|
momentValue.hour(0)
|
|
427
428
|
momentValue.minute(0)
|
|
428
429
|
momentValue.second(0)
|
|
@@ -433,7 +434,7 @@ abstract class SearchFlow {
|
|
|
433
434
|
}
|
|
434
435
|
|
|
435
436
|
if (isNotEmpty(values[1])) {
|
|
436
|
-
var momentValue = moment(values[1])
|
|
437
|
+
var momentValue = moment(values[1]).tz('America/Sao_Paulo', false)
|
|
437
438
|
momentValue.hour(23)
|
|
438
439
|
momentValue.minute(59)
|
|
439
440
|
momentValue.second(59)
|