c2-mongoose 2.1.194 → 2.1.196
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/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,18 +479,18 @@ 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]);
|
|
482
483
|
momentValue.hour(0);
|
|
483
484
|
momentValue.minute(0);
|
|
484
485
|
momentValue.second(0);
|
|
485
|
-
condition[fieldName] = __assign(__assign({}, condition[fieldName]), { $gte: momentValue.toDate() });
|
|
486
|
+
condition[fieldName] = __assign(__assign({}, condition[fieldName]), { $gte: momentValue.tz('America/Sao_Paulo', false).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]);
|
|
489
490
|
momentValue.hour(23);
|
|
490
491
|
momentValue.minute(59);
|
|
491
492
|
momentValue.second(59);
|
|
492
|
-
condition[fieldName] = __assign(__assign({}, condition[fieldName]), { $lte: momentValue.toDate() });
|
|
493
|
+
condition[fieldName] = __assign(__assign({}, condition[fieldName]), { $lte: momentValue.tz('America/Sao_Paulo', false).toDate() });
|
|
493
494
|
}
|
|
494
495
|
filters.$and.push(condition);
|
|
495
496
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c2-mongoose",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.196",
|
|
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/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
|
|
@@ -428,7 +429,7 @@ abstract class SearchFlow {
|
|
|
428
429
|
momentValue.second(0)
|
|
429
430
|
condition[fieldName] = {
|
|
430
431
|
...condition[fieldName],
|
|
431
|
-
$gte: momentValue.toDate()
|
|
432
|
+
$gte: momentValue.tz('America/Sao_Paulo', false).toDate()
|
|
432
433
|
}
|
|
433
434
|
}
|
|
434
435
|
|
|
@@ -439,7 +440,7 @@ abstract class SearchFlow {
|
|
|
439
440
|
momentValue.second(59)
|
|
440
441
|
condition[fieldName] = {
|
|
441
442
|
...condition[fieldName],
|
|
442
|
-
$lte: momentValue.toDate()
|
|
443
|
+
$lte: momentValue.tz('America/Sao_Paulo', false).toDate()
|
|
443
444
|
}
|
|
444
445
|
}
|
|
445
446
|
filters.$and.push(condition)
|