@optimiser/common 1.0.270 → 1.0.273
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/lib/helper.js +35 -0
- package/dist/lib/utility.js +108 -91
- package/package.json +1 -1
package/dist/lib/helper.js
CHANGED
|
@@ -431,118 +431,147 @@ var GetDateRangeFromOperatorValue = function (operator, fiscalMonth, fiscalFrom)
|
|
|
431
431
|
}
|
|
432
432
|
switch (operator) {
|
|
433
433
|
case "Yesterday":
|
|
434
|
+
case "yesterday":
|
|
434
435
|
startDate = momentObj.clone().subtract(1, "days").format(requiredDateFormat);
|
|
435
436
|
endDate = momentObj.clone().subtract(1, "days").format(requiredDateFormat);
|
|
436
437
|
break;
|
|
437
438
|
case "Today":
|
|
439
|
+
case "today":
|
|
438
440
|
startDate = momentObj.clone().format(requiredDateFormat);
|
|
439
441
|
endDate = momentObj.clone().format(requiredDateFormat);
|
|
440
442
|
break;
|
|
441
443
|
case "Tomorrow":
|
|
444
|
+
case "tomorrow":
|
|
442
445
|
startDate = momentObj.clone().add(1, "days").format(requiredDateFormat);
|
|
443
446
|
endDate = momentObj.clone().add(1, "days").format(requiredDateFormat);
|
|
444
447
|
break;
|
|
445
448
|
case "Last 7 Days":
|
|
449
|
+
case "last-7-days":
|
|
446
450
|
startDate = momentObj.clone().subtract(6, "days").format(requiredDateFormat);
|
|
447
451
|
endDate = momentObj.clone().format(requiredDateFormat);
|
|
448
452
|
break;
|
|
449
453
|
case "Last 30 Days":
|
|
454
|
+
case "last-30-days":
|
|
450
455
|
startDate = momentObj.clone().subtract(29, "days").format(requiredDateFormat);
|
|
451
456
|
endDate = momentObj.clone().format(requiredDateFormat);
|
|
452
457
|
break;
|
|
453
458
|
case "Last 60 Days":
|
|
459
|
+
case "last-60-days":
|
|
454
460
|
startDate = momentObj.clone().subtract(59, "days").format(requiredDateFormat);
|
|
455
461
|
endDate = momentObj.clone().format(requiredDateFormat);
|
|
456
462
|
break;
|
|
457
463
|
case "Last 90 Days":
|
|
464
|
+
case "last-90-days":
|
|
458
465
|
startDate = momentObj.clone().subtract(89, "days").format(requiredDateFormat);
|
|
459
466
|
endDate = momentObj.clone().format(requiredDateFormat);
|
|
460
467
|
break;
|
|
461
468
|
case "Last 120 Days":
|
|
469
|
+
case "last-120-days":
|
|
462
470
|
startDate = momentObj.clone().subtract(119, "days").format(requiredDateFormat);
|
|
463
471
|
endDate = momentObj.clone().format(requiredDateFormat);
|
|
464
472
|
break;
|
|
465
473
|
case "Next 7 Days":
|
|
474
|
+
case "next-7-days":
|
|
466
475
|
startDate = momentObj.clone().format(requiredDateFormat);
|
|
467
476
|
endDate = momentObj.clone().add(6, "days").format(requiredDateFormat);
|
|
468
477
|
break;
|
|
469
478
|
case "Next 30 Days":
|
|
479
|
+
case "next-30-days":
|
|
470
480
|
startDate = momentObj.clone().format(requiredDateFormat);
|
|
471
481
|
endDate = momentObj.clone().add(29, "days").format(requiredDateFormat);
|
|
472
482
|
break;
|
|
473
483
|
case "Next 60 Days":
|
|
484
|
+
case "next-60-days":
|
|
474
485
|
startDate = momentObj.clone().format(requiredDateFormat);
|
|
475
486
|
endDate = momentObj.clone().add(59, "days").format(requiredDateFormat);
|
|
476
487
|
break;
|
|
477
488
|
case "Next 90 Days":
|
|
489
|
+
case "next-90-days":
|
|
478
490
|
startDate = momentObj.clone().format(requiredDateFormat);
|
|
479
491
|
endDate = momentObj.clone().add(89, "days").format(requiredDateFormat);
|
|
480
492
|
break;
|
|
481
493
|
case "Next 120 Days":
|
|
494
|
+
case "next-120-days":
|
|
482
495
|
startDate = momentObj.clone().format(requiredDateFormat);
|
|
483
496
|
endDate = momentObj.clone().add(119, "days").format(requiredDateFormat);
|
|
484
497
|
break;
|
|
485
498
|
case "Last Week":
|
|
499
|
+
case "last-week":
|
|
486
500
|
startDate = momentObj.clone().subtract(1, "weeks").startOf('isoWeek').format(requiredDateFormat);
|
|
487
501
|
endDate = momentObj.clone().subtract(1, "weeks").endOf('isoWeek').format(requiredDateFormat);
|
|
488
502
|
break;
|
|
489
503
|
case "This Week":
|
|
504
|
+
case "this-week":
|
|
490
505
|
startDate = momentObj.clone().startOf('isoWeek').format(requiredDateFormat);
|
|
491
506
|
endDate = momentObj.clone().endOf('isoWeek').format(requiredDateFormat);
|
|
492
507
|
break;
|
|
493
508
|
case "Next Week":
|
|
509
|
+
case "next-week":
|
|
494
510
|
startDate = momentObj.clone().add(1, "weeks").startOf('isoWeek').format(requiredDateFormat);
|
|
495
511
|
endDate = momentObj.clone().add(1, "weeks").endOf('isoWeek').format(requiredDateFormat);
|
|
496
512
|
break;
|
|
497
513
|
case "Last Month":
|
|
514
|
+
case "last-month":
|
|
498
515
|
startDate = momentObj.clone().subtract(1, "months").startOf('month').format(requiredDateFormat);
|
|
499
516
|
endDate = momentObj.clone().subtract(1, "months").endOf('month').format(requiredDateFormat);
|
|
500
517
|
break;
|
|
501
518
|
case "This Month":
|
|
519
|
+
case "this-month":
|
|
502
520
|
startDate = momentObj.clone().startOf('month').format(requiredDateFormat);
|
|
503
521
|
endDate = momentObj.clone().endOf('month').format(requiredDateFormat);
|
|
504
522
|
break;
|
|
505
523
|
case "Next Month":
|
|
524
|
+
case "next-month":
|
|
506
525
|
startDate = momentObj.clone().add(1, "months").startOf('month').format(requiredDateFormat);
|
|
507
526
|
endDate = momentObj.clone().add(1, "months").endOf('month').format(requiredDateFormat);
|
|
508
527
|
break;
|
|
509
528
|
case "Last Quarter":
|
|
529
|
+
case "last-quarter":
|
|
510
530
|
startDate = momentObj.clone().subtract(1, "quarters").startOf('quarter').format(requiredDateFormat);
|
|
511
531
|
endDate = momentObj.clone().subtract(1, "quarters").endOf('quarter').format(requiredDateFormat);
|
|
512
532
|
break;
|
|
513
533
|
case "This Quarter":
|
|
534
|
+
case "this-quarter":
|
|
514
535
|
startDate = momentObj.clone().startOf('quarter').format(requiredDateFormat);
|
|
515
536
|
endDate = momentObj.clone().endOf('quarter').format(requiredDateFormat);
|
|
516
537
|
break;
|
|
517
538
|
case "Next Quarter":
|
|
539
|
+
case "next-quarter":
|
|
518
540
|
startDate = momentObj.clone().add(1, "quarters").startOf('quarter').format(requiredDateFormat);
|
|
519
541
|
endDate = momentObj.clone().add(1, "quarters").endOf('quarter').format(requiredDateFormat);
|
|
520
542
|
break;
|
|
521
543
|
case "Last Fiscal Quarter":
|
|
544
|
+
case "last-fiscal-quarter":
|
|
522
545
|
startDate = moment_1.default(startDate, currentDateFormat).clone().subtract(3, "months").startOf('month').format(requiredDateFormat);
|
|
523
546
|
endDate = moment_1.default(startDate, currentDateFormat).clone().add(2, "months").endOf('month').format(requiredDateFormat);
|
|
524
547
|
break;
|
|
525
548
|
case "This Fiscal Quarter":
|
|
549
|
+
case "this-fiscal-quarter":
|
|
526
550
|
startDate = startDate;
|
|
527
551
|
endDate = endDate;
|
|
528
552
|
break;
|
|
529
553
|
case "Next Fiscal Quarter":
|
|
554
|
+
case "next-fiscal-quarter":
|
|
530
555
|
startDate = moment_1.default(startDate, currentDateFormat).clone().add(3, "months").startOf('month').format(requiredDateFormat);
|
|
531
556
|
endDate = moment_1.default(startDate, currentDateFormat).clone().add(2, "months").endOf('month').format(requiredDateFormat);
|
|
532
557
|
break;
|
|
533
558
|
case "Last Year":
|
|
559
|
+
case "last-year":
|
|
534
560
|
startDate = momentObj.clone().subtract(1, "years").startOf('year').format(requiredDateFormat);
|
|
535
561
|
endDate = momentObj.clone().subtract(1, "years").endOf('year').format(requiredDateFormat);
|
|
536
562
|
break;
|
|
537
563
|
case "This Year":
|
|
564
|
+
case "this-year":
|
|
538
565
|
startDate = momentObj.clone().startOf('year').format(requiredDateFormat);
|
|
539
566
|
endDate = momentObj.clone().endOf('year').format(requiredDateFormat);
|
|
540
567
|
break;
|
|
541
568
|
case "Next Year":
|
|
569
|
+
case "next-year":
|
|
542
570
|
startDate = momentObj.clone().add(1, "years").startOf('year').format(requiredDateFormat);
|
|
543
571
|
endDate = momentObj.clone().add(1, "years").endOf('year').format(requiredDateFormat);
|
|
544
572
|
break;
|
|
545
573
|
case "Last Fiscal Year":
|
|
574
|
+
case "last-fiscal-year":
|
|
546
575
|
if (fiscalFrom === "Start") {
|
|
547
576
|
if (getFiscalMonthIndex == 0 || getFiscalMonthIndex && getFiscalMonthIndex <= momentObj.clone().month()) {
|
|
548
577
|
startDate = moment_1.default(startDate, currentDateFormat).clone().month(fiscalMonth).subtract(12, "months").startOf('month').format(requiredDateFormat);
|
|
@@ -565,6 +594,7 @@ var GetDateRangeFromOperatorValue = function (operator, fiscalMonth, fiscalFrom)
|
|
|
565
594
|
}
|
|
566
595
|
break;
|
|
567
596
|
case "This Fiscal Year":
|
|
597
|
+
case "this-fiscal-quarter":
|
|
568
598
|
if (fiscalFrom === "Start") {
|
|
569
599
|
if (getFiscalMonthIndex == 0 || getFiscalMonthIndex && getFiscalMonthIndex <= momentObj.clone().month()) {
|
|
570
600
|
startDate = moment_1.default(startDate, currentDateFormat).clone().month(fiscalMonth).startOf('month').format(requiredDateFormat);
|
|
@@ -587,6 +617,7 @@ var GetDateRangeFromOperatorValue = function (operator, fiscalMonth, fiscalFrom)
|
|
|
587
617
|
}
|
|
588
618
|
break;
|
|
589
619
|
case "Next Fiscal Year":
|
|
620
|
+
case "next-fiscal-quarter":
|
|
590
621
|
if (fiscalFrom === "Start") {
|
|
591
622
|
if (getFiscalMonthIndex == 0 || getFiscalMonthIndex && getFiscalMonthIndex <= momentObj.clone().month()) {
|
|
592
623
|
startDate = moment_1.default(startDate, currentDateFormat).clone().month(fiscalMonth).add(1, "years").startOf('month').format(requiredDateFormat);
|
|
@@ -609,18 +640,22 @@ var GetDateRangeFromOperatorValue = function (operator, fiscalMonth, fiscalFrom)
|
|
|
609
640
|
}
|
|
610
641
|
break;
|
|
611
642
|
case "Current Calendar Year":
|
|
643
|
+
case "current-calendar-year":
|
|
612
644
|
startDate = momentObj.clone().startOf('year').format(requiredDateFormat);
|
|
613
645
|
endDate = momentObj.clone().endOf('year').format(requiredDateFormat);
|
|
614
646
|
break;
|
|
615
647
|
case "Previous Calendar Year":
|
|
648
|
+
case "previous-calendar-year":
|
|
616
649
|
startDate = momentObj.clone().subtract(1, "years").startOf('year').format(requiredDateFormat);
|
|
617
650
|
endDate = momentObj.clone().subtract(1, "years").endOf('year').format(requiredDateFormat);
|
|
618
651
|
break;
|
|
619
652
|
case "Next Calendar Year":
|
|
653
|
+
case "next-calendar-year":
|
|
620
654
|
startDate = momentObj.clone().add(1, "years").startOf('year').format(requiredDateFormat);
|
|
621
655
|
endDate = momentObj.clone().add(1, "years").endOf('year').format(requiredDateFormat);
|
|
622
656
|
break;
|
|
623
657
|
case "Year to Date":
|
|
658
|
+
case "year-to-date":
|
|
624
659
|
endDate = momentObj.clone().format(requiredDateFormat);
|
|
625
660
|
if (parseInt(momentObj.format('M')) > 3) {
|
|
626
661
|
startDate = momentObj.clone().startOf('month').month("Apr").format(requiredDateFormat);
|
package/dist/lib/utility.js
CHANGED
|
@@ -96,6 +96,7 @@ var errorHandlerForServices_1 = __importDefault(require("../utility/errorHandler
|
|
|
96
96
|
var cryptoService = __importStar(require("../utility/crypto"));
|
|
97
97
|
var countrycode_1 = require("./countrycode");
|
|
98
98
|
require("moment-timezone");
|
|
99
|
+
var helper_1 = require("./helper");
|
|
99
100
|
var sanitize = require('mongo-sanitize');
|
|
100
101
|
function GetObjectByKeyValueFromList(list, key, val) {
|
|
101
102
|
if (list && list.length > 0) {
|
|
@@ -1801,7 +1802,9 @@ function BuildGridFieldProjection(project, field, group) {
|
|
|
1801
1802
|
project[alias] = 1;
|
|
1802
1803
|
if (field.Schema.LookupObject) {
|
|
1803
1804
|
for (var i = 0; i < field.Schema.LookupFields.length; i++) {
|
|
1804
|
-
searchConcatArry.push({ "$ifNull": ['$' + alias + '.' + field.Schema.LookupFields[i], ""] });
|
|
1805
|
+
//searchConcatArry.push({ "$ifNull": ['$' + alias + '.' + field.Schema.LookupFields[i], ""] });
|
|
1806
|
+
// added by Mohan, make int to string and concat
|
|
1807
|
+
searchConcatArry.push({ "$ifNull": [{ $toString: '$' + alias + '.' + field.Schema.LookupFields[i] }, ""] });
|
|
1805
1808
|
if (i < field.Schema.LookupFields.length - 1) {
|
|
1806
1809
|
searchConcatArry.push(" ");
|
|
1807
1810
|
}
|
|
@@ -2009,6 +2012,7 @@ function BuildLookupFieldProjection(field, group, project, aggregateArry) {
|
|
|
2009
2012
|
}
|
|
2010
2013
|
exports.BuildLookupFieldProjection = BuildLookupFieldProjection;
|
|
2011
2014
|
function FilterConditions(condition, match, fields) {
|
|
2015
|
+
var _a, _b;
|
|
2012
2016
|
if (condition != undefined && condition.Filters.length > 0) {
|
|
2013
2017
|
var sets = void 0;
|
|
2014
2018
|
if (condition.Condition == 'AND') {
|
|
@@ -2061,105 +2065,118 @@ function FilterConditions(condition, match, fields) {
|
|
|
2061
2065
|
break;
|
|
2062
2066
|
}
|
|
2063
2067
|
}
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
matchValue = { '$eq': obj.Value };
|
|
2088
|
-
}
|
|
2089
|
-
else if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2090
|
-
matchValue = { '$gte': moment_1.default(obj.Value).startOf('day').toDate(), '$lte': moment_1.default(obj.Value).endOf('day').toDate() };
|
|
2091
|
-
}
|
|
2092
|
-
else if (["int", "decimal", "percent"].includes(field.Schema.UIDataType)) {
|
|
2093
|
-
matchValue = { '$eq': obj.Value };
|
|
2094
|
-
}
|
|
2095
|
-
else if (field.Schema.UIDataType == 'checkbox') {
|
|
2096
|
-
if (obj.Value == 'true' || obj.Value === true)
|
|
2097
|
-
matchValue = true;
|
|
2068
|
+
// Below If condition added by Nidhi - QPC-5338
|
|
2069
|
+
if (field.Schema.UIDataType === 'date' || field.Schema.UIDataType === 'datetime') {
|
|
2070
|
+
var operator = obj.Operator;
|
|
2071
|
+
var startCompareDate = void 0, endCompareDate = void 0;
|
|
2072
|
+
if (operator === "custom") {
|
|
2073
|
+
startCompareDate = moment_1.default((_a = obj.Value) === null || _a === void 0 ? void 0 : _a.From, "DD-MMM-YYYY").startOf('day');
|
|
2074
|
+
endCompareDate = moment_1.default((_b = obj.Value) === null || _b === void 0 ? void 0 : _b.To, "DD-MMM-YYYY").endOf('day');
|
|
2075
|
+
}
|
|
2076
|
+
else {
|
|
2077
|
+
var _a = helper_1.GetDateRangeFromOperatorValue(operator, obj.FiscalMonth, obj.FiscalFrom), startDate = _a.startDate, endDate = _a.endDate;
|
|
2078
|
+
startCompareDate = moment_1.default(startDate, "DD-MMM-YYYY").startOf('day');
|
|
2079
|
+
endCompareDate = moment_1.default(endDate, "DD-MMM-YYYY").endOf('day');
|
|
2080
|
+
}
|
|
2081
|
+
matchValue = { '$gte': new Date(moment_1.default(startCompareDate).toISOString()), '$lte': new Date(moment_1.default(endCompareDate).toISOString()) };
|
|
2082
|
+
}
|
|
2083
|
+
else {
|
|
2084
|
+
switch (obj.Operator) {
|
|
2085
|
+
case "CONTAINS":
|
|
2086
|
+
if (obj.Value === '')
|
|
2087
|
+
matchValue = { '$in': [null, ''] };
|
|
2088
|
+
else if (["dropdown", "multiselect"].includes(field.Schema.UIDataType)) {
|
|
2089
|
+
matchValue = { '$in': obj.Value };
|
|
2090
|
+
}
|
|
2098
2091
|
else
|
|
2099
|
-
matchValue = { $
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
if (obj.Value)
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2092
|
+
matchValue = { '$regex': obj.Value, '$options': 'i' };
|
|
2093
|
+
break;
|
|
2094
|
+
case "NOT_CONTAINS":
|
|
2095
|
+
if (obj.Value === '')
|
|
2096
|
+
matchValue = { '$nin': [null, ''] };
|
|
2097
|
+
else if (["dropdown", "multiselect"].includes(field.Schema.UIDataType)) {
|
|
2098
|
+
matchValue = { '$nin': obj.Value };
|
|
2099
|
+
}
|
|
2100
|
+
else
|
|
2101
|
+
matchValue = { '$regex': '^((?!' + obj.Value + ').)*$', '$options': 'i' };
|
|
2102
|
+
break;
|
|
2103
|
+
case "EQUAL":
|
|
2104
|
+
if (obj.Value === '')
|
|
2105
|
+
matchValue = { '$in': [null, ''] };
|
|
2106
|
+
else if (field.Schema.SearchType == 'dropdown') {
|
|
2107
|
+
matchValue = { '$eq': obj.Value };
|
|
2108
|
+
}
|
|
2109
|
+
// else if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2110
|
+
// matchValue = { '$gte': moment(obj.Value).startOf('day').toDate(), '$lte': moment(obj.Value).endOf('day').toDate() };
|
|
2111
|
+
// }
|
|
2112
|
+
else if (["int", "decimal", "percent"].includes(field.Schema.UIDataType)) {
|
|
2113
|
+
matchValue = { '$eq': obj.Value };
|
|
2114
|
+
}
|
|
2115
|
+
else if (field.Schema.UIDataType == 'checkbox') {
|
|
2116
|
+
if (obj.Value == 'true' || obj.Value === true)
|
|
2117
|
+
matchValue = true;
|
|
2118
|
+
else
|
|
2119
|
+
matchValue = { $ne: true };
|
|
2120
|
+
}
|
|
2121
|
+
else if (["lookup", "multilookup"].includes(field.Schema.UIDataType) && obj.ValueType == 'ObjectID') {
|
|
2122
|
+
if (obj.Value) {
|
|
2123
|
+
if (field.Schema.UIDataType == "lookup")
|
|
2124
|
+
matchValue = obj.Value;
|
|
2125
|
+
else {
|
|
2126
|
+
matchValue = {
|
|
2127
|
+
'$in': [obj.Value]
|
|
2128
|
+
};
|
|
2129
|
+
}
|
|
2109
2130
|
}
|
|
2110
2131
|
}
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
matchValue = { '$ne': obj.Value };
|
|
2123
|
-
}
|
|
2124
|
-
else
|
|
2125
|
-
matchValue = { '$regex': '^(?!' + obj.Value + '$)', '$options': 'i' };
|
|
2126
|
-
break;
|
|
2127
|
-
case "GREATER_THAN":
|
|
2128
|
-
if (obj.Value) {
|
|
2129
|
-
if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2130
|
-
matchValue = { '$gt': moment_1.default(obj.Value).endOf('day').toDate() };
|
|
2132
|
+
else
|
|
2133
|
+
matchValue = { '$regex': '^' + obj.Value + '$', '$options': 'i' };
|
|
2134
|
+
break;
|
|
2135
|
+
case "NOT_EQUAL":
|
|
2136
|
+
if (obj.Value === '')
|
|
2137
|
+
matchValue = { '$nin': [null, ''] };
|
|
2138
|
+
else if (field.Schema.SearchType == 'dropdown') {
|
|
2139
|
+
matchValue = { '$ne': obj.Value };
|
|
2140
|
+
}
|
|
2141
|
+
else if (["int", "decimal", "percent", "time"].includes(field.Schema.UIDataType)) {
|
|
2142
|
+
matchValue = { '$ne': obj.Value };
|
|
2131
2143
|
}
|
|
2132
2144
|
else
|
|
2145
|
+
matchValue = { '$regex': '^(?!' + obj.Value + '$)', '$options': 'i' };
|
|
2146
|
+
break;
|
|
2147
|
+
case "GREATER_THAN":
|
|
2148
|
+
if (obj.Value) {
|
|
2149
|
+
// if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2150
|
+
// matchValue = { '$gt': moment(obj.Value).endOf('day').toDate() };
|
|
2151
|
+
// } else
|
|
2133
2152
|
matchValue = { '$gt': obj.Value };
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
matchValue = { '$lt':
|
|
2139
|
-
|
|
2140
|
-
else
|
|
2153
|
+
}
|
|
2154
|
+
break;
|
|
2155
|
+
case "LESS_THAN":
|
|
2156
|
+
// if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2157
|
+
// matchValue = { '$lt': moment(obj.Value).startOf('day').toDate() }
|
|
2158
|
+
// } else
|
|
2141
2159
|
matchValue = { '$lt': obj.Value };
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
matchValue = { '$gte':
|
|
2146
|
-
|
|
2147
|
-
else
|
|
2160
|
+
break;
|
|
2161
|
+
case "GREATER_OR_EQUAL":
|
|
2162
|
+
// if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2163
|
+
// matchValue = { '$gte': moment(obj.Value).startOf('day').toDate() }
|
|
2164
|
+
// } else
|
|
2148
2165
|
matchValue = { '$gte': obj.Value };
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
matchValue = { '$lte':
|
|
2153
|
-
|
|
2154
|
-
else
|
|
2166
|
+
break;
|
|
2167
|
+
case "LESS_OR_EQUAL":
|
|
2168
|
+
// if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2169
|
+
// matchValue = { '$lte': moment(obj.Value).endOf('day').toDate() }
|
|
2170
|
+
// } else
|
|
2155
2171
|
matchValue = { '$lte': obj.Value };
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2172
|
+
break;
|
|
2173
|
+
case "STARTS_WITH":
|
|
2174
|
+
matchValue = { '$regex': '^' + obj.Value, '$options': 'i' };
|
|
2175
|
+
break;
|
|
2176
|
+
case "END_WITH":
|
|
2177
|
+
matchValue = { '$regex': obj.Value + '$', '$options': 'i' };
|
|
2178
|
+
break;
|
|
2179
|
+
}
|
|
2163
2180
|
}
|
|
2164
2181
|
var fieldMatch = {};
|
|
2165
2182
|
fieldMatch[fldName] = matchValue;
|