tango-app-api-infra 3.9.5-vms.82 → 3.9.5-vms.83
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/package.json
CHANGED
|
@@ -284,20 +284,41 @@ export async function ticketCreation( req, res, next ) {
|
|
|
284
284
|
},
|
|
285
285
|
},
|
|
286
286
|
|
|
287
|
-
//
|
|
287
|
+
// Convert all effectiveFrom to proper Date
|
|
288
|
+
{
|
|
289
|
+
$addFields: {
|
|
290
|
+
taggingLimitationWithDate: {
|
|
291
|
+
$map: {
|
|
292
|
+
input: '$footfallDirectoryConfigs.taggingLimitation',
|
|
293
|
+
as: 'item',
|
|
294
|
+
in: {
|
|
295
|
+
effectiveFrom: { $toDate: '$$item.effectiveFrom' },
|
|
296
|
+
values: '$$item.values',
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
|
|
303
|
+
// Filter items <= input date
|
|
288
304
|
{
|
|
289
305
|
$addFields: {
|
|
290
306
|
matchedLimitation: {
|
|
291
307
|
$filter: {
|
|
292
|
-
input: '$
|
|
308
|
+
input: '$taggingLimitationWithDate',
|
|
293
309
|
as: 'item',
|
|
294
|
-
cond: {
|
|
310
|
+
cond: {
|
|
311
|
+
$lte: [
|
|
312
|
+
'$$item.effectiveFrom',
|
|
313
|
+
{ $toDate: inputData.dateString },
|
|
314
|
+
],
|
|
315
|
+
},
|
|
295
316
|
},
|
|
296
317
|
},
|
|
297
318
|
},
|
|
298
319
|
},
|
|
299
320
|
|
|
300
|
-
//
|
|
321
|
+
// Sort DESC and pick ONLY top 1 -> latest effective record
|
|
301
322
|
{
|
|
302
323
|
$addFields: {
|
|
303
324
|
effectiveLimitation: {
|
|
@@ -319,26 +340,11 @@ export async function ticketCreation( req, res, next ) {
|
|
|
319
340
|
},
|
|
320
341
|
},
|
|
321
342
|
|
|
322
|
-
// Remove originals before final merge
|
|
323
|
-
{
|
|
324
|
-
$project: {
|
|
325
|
-
'config.taggingLimitation': 0,
|
|
326
|
-
'matchedLimitation': 0,
|
|
327
|
-
},
|
|
328
|
-
},
|
|
329
|
-
|
|
330
|
-
// Attach effective limitation INSIDE config
|
|
331
|
-
{
|
|
332
|
-
$addFields: {
|
|
333
|
-
'config.effectiveLimitation': '$effectiveLimitation',
|
|
334
|
-
},
|
|
335
|
-
},
|
|
336
|
-
|
|
337
|
-
// Remove temporary field
|
|
338
343
|
{
|
|
339
344
|
$project: {
|
|
345
|
+
config: 1,
|
|
346
|
+
effectiveLimitation: 1,
|
|
340
347
|
footfallDirectoryConfigs: 1,
|
|
341
|
-
clientId: 1,
|
|
342
348
|
},
|
|
343
349
|
},
|
|
344
350
|
];
|
|
@@ -351,10 +357,10 @@ export async function ticketCreation( req, res, next ) {
|
|
|
351
357
|
}
|
|
352
358
|
|
|
353
359
|
// Get taggingLimitation from config (check both possible paths)
|
|
354
|
-
const taggingLimitation = getConfig?.
|
|
360
|
+
const taggingLimitation = getConfig?.effectiveLimitation?.values;
|
|
355
361
|
// Initialize count object from taggingLimitation
|
|
356
362
|
const tempAcc = [];
|
|
357
|
-
taggingLimitation
|
|
363
|
+
taggingLimitation.reduce( ( acc, item ) => {
|
|
358
364
|
if ( item?.type ) {
|
|
359
365
|
// Convert type to camelCase with "Count" suffix
|
|
360
366
|
// e.g., "duplicate" -> "duplicateCount", "housekeeping" -> "houseKeepingCount"
|
|
@@ -996,20 +1002,41 @@ export async function ticketReview( req, res, next ) {
|
|
|
996
1002
|
},
|
|
997
1003
|
},
|
|
998
1004
|
|
|
999
|
-
//
|
|
1005
|
+
// Convert all effectiveFrom to proper Date
|
|
1006
|
+
{
|
|
1007
|
+
$addFields: {
|
|
1008
|
+
taggingLimitationWithDate: {
|
|
1009
|
+
$map: {
|
|
1010
|
+
input: '$footfallDirectoryConfigs.taggingLimitation',
|
|
1011
|
+
as: 'item',
|
|
1012
|
+
in: {
|
|
1013
|
+
effectiveFrom: { $toDate: '$$item.effectiveFrom' },
|
|
1014
|
+
values: '$$item.values',
|
|
1015
|
+
},
|
|
1016
|
+
},
|
|
1017
|
+
},
|
|
1018
|
+
},
|
|
1019
|
+
},
|
|
1020
|
+
|
|
1021
|
+
// Filter items <= input date
|
|
1000
1022
|
{
|
|
1001
1023
|
$addFields: {
|
|
1002
1024
|
matchedLimitation: {
|
|
1003
1025
|
$filter: {
|
|
1004
|
-
input: '$
|
|
1026
|
+
input: '$taggingLimitationWithDate',
|
|
1005
1027
|
as: 'item',
|
|
1006
|
-
cond: {
|
|
1028
|
+
cond: {
|
|
1029
|
+
$lte: [
|
|
1030
|
+
'$$item.effectiveFrom',
|
|
1031
|
+
{ $toDate: inputData.dateString },
|
|
1032
|
+
],
|
|
1033
|
+
},
|
|
1007
1034
|
},
|
|
1008
1035
|
},
|
|
1009
1036
|
},
|
|
1010
1037
|
},
|
|
1011
1038
|
|
|
1012
|
-
//
|
|
1039
|
+
// Sort DESC and pick ONLY top 1 -> latest effective record
|
|
1013
1040
|
{
|
|
1014
1041
|
$addFields: {
|
|
1015
1042
|
effectiveLimitation: {
|
|
@@ -1031,26 +1058,11 @@ export async function ticketReview( req, res, next ) {
|
|
|
1031
1058
|
},
|
|
1032
1059
|
},
|
|
1033
1060
|
|
|
1034
|
-
// Remove originals before final merge
|
|
1035
|
-
{
|
|
1036
|
-
$project: {
|
|
1037
|
-
'config.taggingLimitation': 0,
|
|
1038
|
-
'matchedLimitation': 0,
|
|
1039
|
-
},
|
|
1040
|
-
},
|
|
1041
|
-
|
|
1042
|
-
// Attach effective limitation INSIDE config
|
|
1043
|
-
{
|
|
1044
|
-
$addFields: {
|
|
1045
|
-
'config.effectiveLimitation': '$effectiveLimitation',
|
|
1046
|
-
},
|
|
1047
|
-
},
|
|
1048
|
-
|
|
1049
|
-
// Remove temporary field
|
|
1050
1061
|
{
|
|
1051
1062
|
$project: {
|
|
1063
|
+
config: 1,
|
|
1064
|
+
effectiveLimitation: 1,
|
|
1052
1065
|
footfallDirectoryConfigs: 1,
|
|
1053
|
-
clientId: 1,
|
|
1054
1066
|
},
|
|
1055
1067
|
},
|
|
1056
1068
|
];
|
|
@@ -1063,10 +1075,10 @@ export async function ticketReview( req, res, next ) {
|
|
|
1063
1075
|
}
|
|
1064
1076
|
|
|
1065
1077
|
// Get taggingLimitation from config (check both possible paths)
|
|
1066
|
-
const taggingLimitation = getConfig?.
|
|
1078
|
+
const taggingLimitation = getConfig?.effectiveLimitation?.values;
|
|
1067
1079
|
// Initialize count object from taggingLimitation
|
|
1068
1080
|
const tempAcc = [];
|
|
1069
|
-
taggingLimitation
|
|
1081
|
+
taggingLimitation.reduce( ( acc, item ) => {
|
|
1070
1082
|
if ( item?.type ) {
|
|
1071
1083
|
// Convert type to camelCase with "Count" suffix
|
|
1072
1084
|
// e.g., "duplicate" -> "duplicateCount", "housekeeping" -> "houseKeepingCount"
|
|
@@ -1598,20 +1610,41 @@ export async function ticketApprove( req, res, next ) {
|
|
|
1598
1610
|
},
|
|
1599
1611
|
},
|
|
1600
1612
|
|
|
1601
|
-
//
|
|
1613
|
+
// Convert all effectiveFrom to proper Date
|
|
1614
|
+
{
|
|
1615
|
+
$addFields: {
|
|
1616
|
+
taggingLimitationWithDate: {
|
|
1617
|
+
$map: {
|
|
1618
|
+
input: '$footfallDirectoryConfigs.taggingLimitation',
|
|
1619
|
+
as: 'item',
|
|
1620
|
+
in: {
|
|
1621
|
+
effectiveFrom: { $toDate: '$$item.effectiveFrom' },
|
|
1622
|
+
values: '$$item.values',
|
|
1623
|
+
},
|
|
1624
|
+
},
|
|
1625
|
+
},
|
|
1626
|
+
},
|
|
1627
|
+
},
|
|
1628
|
+
|
|
1629
|
+
// Filter items <= input date
|
|
1602
1630
|
{
|
|
1603
1631
|
$addFields: {
|
|
1604
1632
|
matchedLimitation: {
|
|
1605
1633
|
$filter: {
|
|
1606
|
-
input: '$
|
|
1634
|
+
input: '$taggingLimitationWithDate',
|
|
1607
1635
|
as: 'item',
|
|
1608
|
-
cond: {
|
|
1636
|
+
cond: {
|
|
1637
|
+
$lte: [
|
|
1638
|
+
'$$item.effectiveFrom',
|
|
1639
|
+
{ $toDate: inputData.dateString },
|
|
1640
|
+
],
|
|
1641
|
+
},
|
|
1609
1642
|
},
|
|
1610
1643
|
},
|
|
1611
1644
|
},
|
|
1612
1645
|
},
|
|
1613
1646
|
|
|
1614
|
-
//
|
|
1647
|
+
// Sort DESC and pick ONLY top 1 -> latest effective record
|
|
1615
1648
|
{
|
|
1616
1649
|
$addFields: {
|
|
1617
1650
|
effectiveLimitation: {
|
|
@@ -1633,26 +1666,11 @@ export async function ticketApprove( req, res, next ) {
|
|
|
1633
1666
|
},
|
|
1634
1667
|
},
|
|
1635
1668
|
|
|
1636
|
-
// Remove originals before final merge
|
|
1637
|
-
{
|
|
1638
|
-
$project: {
|
|
1639
|
-
'config.taggingLimitation': 0,
|
|
1640
|
-
'matchedLimitation': 0,
|
|
1641
|
-
},
|
|
1642
|
-
},
|
|
1643
|
-
|
|
1644
|
-
// Attach effective limitation INSIDE config
|
|
1645
|
-
{
|
|
1646
|
-
$addFields: {
|
|
1647
|
-
'config.effectiveLimitation': '$effectiveLimitation',
|
|
1648
|
-
},
|
|
1649
|
-
},
|
|
1650
|
-
|
|
1651
|
-
// Remove temporary field
|
|
1652
1669
|
{
|
|
1653
1670
|
$project: {
|
|
1671
|
+
config: 1,
|
|
1672
|
+
effectiveLimitation: 1,
|
|
1654
1673
|
footfallDirectoryConfigs: 1,
|
|
1655
|
-
clientId: 1,
|
|
1656
1674
|
},
|
|
1657
1675
|
},
|
|
1658
1676
|
];
|
|
@@ -1665,10 +1683,10 @@ export async function ticketApprove( req, res, next ) {
|
|
|
1665
1683
|
}
|
|
1666
1684
|
|
|
1667
1685
|
// Get taggingLimitation from config (check both possible paths)
|
|
1668
|
-
const taggingLimitation = getConfig?.
|
|
1686
|
+
const taggingLimitation = getConfig?.effectiveLimitation?.values;
|
|
1669
1687
|
// Initialize count object from taggingLimitation
|
|
1670
1688
|
const tempAcc = [];
|
|
1671
|
-
taggingLimitation
|
|
1689
|
+
taggingLimitation.reduce( ( acc, item ) => {
|
|
1672
1690
|
if ( item?.type ) {
|
|
1673
1691
|
// Convert type to camelCase with "Count" suffix
|
|
1674
1692
|
// e.g., "duplicate" -> "duplicateCount", "housekeeping" -> "houseKeepingCount"
|