tango-app-api-infra 3.9.5-vms.82 → 3.9.5-vms.84
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
|
@@ -312,6 +312,33 @@ export async function tangoReviewTicket( req, res ) {
|
|
|
312
312
|
|
|
313
313
|
record.mappingInfo = [ ...ticketData?.[0]?._source?.mappingInfo.slice( 0, -1 ),
|
|
314
314
|
...temp ];
|
|
315
|
+
|
|
316
|
+
if ( Array.isArray( record.mappingInfo ) ) {
|
|
317
|
+
record.mappingInfo = record.mappingInfo.map( ( item ) => {
|
|
318
|
+
return {
|
|
319
|
+
...item,
|
|
320
|
+
status: item.type === 'approve'? 'Tango Review Done':'Closed',
|
|
321
|
+
};
|
|
322
|
+
} );
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
record.mappingInfo.push(
|
|
326
|
+
{
|
|
327
|
+
type: 'finalRevision',
|
|
328
|
+
mode: inputData.mappingInfo?.mode,
|
|
329
|
+
revicedFootfall: revisedFootfall,
|
|
330
|
+
revicedPerc: inputData.mappingInfo?.revicedPerc,
|
|
331
|
+
count: inputData.mappingInfo?.count,
|
|
332
|
+
revisedDetail: inputData.mappingInfo?.revisedDetail,
|
|
333
|
+
status: 'Closed',
|
|
334
|
+
createdByEmail: req?.user?.email,
|
|
335
|
+
createdByUserName: req?.user?.userName,
|
|
336
|
+
createdByRole: req?.user?.role,
|
|
337
|
+
createdAt: new Date(),
|
|
338
|
+
},
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
);
|
|
315
342
|
}
|
|
316
343
|
} else {
|
|
317
344
|
if ( Array.isArray( record.mappingInfo ) ) {
|
|
@@ -392,7 +419,7 @@ export async function tangoReviewTicket( req, res ) {
|
|
|
392
419
|
const insertResult = await updateOpenSearchData( openSearch.footfallDirectory, id, { doc: record } );
|
|
393
420
|
|
|
394
421
|
if ( insertResult && ( insertResult.statusCode === 201 || insertResult.statusCode === 200 ) ) {
|
|
395
|
-
if ( record.status
|
|
422
|
+
if ( ( record.status === 'Closed' || record.status === 'Open - Accuracy Issue' ) && inputData.ticketType !== 'internal' ) {
|
|
396
423
|
const query = {
|
|
397
424
|
storeId: inputData?.storeId,
|
|
398
425
|
isVideoStream: true,
|
|
@@ -532,7 +559,7 @@ export async function tangoReviewAccuracyClosedTicket( req, res ) {
|
|
|
532
559
|
},
|
|
533
560
|
},
|
|
534
561
|
};
|
|
535
|
-
if ( Ticket[0]?._source?.type
|
|
562
|
+
if ( Ticket[0]?._source?.type !== 'internal' ) {
|
|
536
563
|
getTicket.query.bool.must.push(
|
|
537
564
|
{
|
|
538
565
|
nested: {
|
|
@@ -576,22 +603,24 @@ export async function tangoReviewAccuracyClosedTicket( req, res ) {
|
|
|
576
603
|
.filter( ( item ) => item.type === 'tangoreview' )
|
|
577
604
|
.map( ( item ) => ( {
|
|
578
605
|
...item,
|
|
579
|
-
status: 'Closed',
|
|
606
|
+
status: 'Closed - Accuracy Issue',
|
|
580
607
|
createdByEmail: req?.user?.email,
|
|
581
608
|
createdByUserName: req?.user?.userName,
|
|
582
609
|
createdByRole: req?.user?.role,
|
|
610
|
+
comments: inputData?.comments || '',
|
|
611
|
+
subComments: inputData?.subComments ||'',
|
|
583
612
|
} ) );
|
|
584
613
|
|
|
585
614
|
record.mappingInfo = [ ...ticketData?.[0]?._source?.mappingInfo.slice( 0, -1 ),
|
|
586
615
|
...temp ];
|
|
587
|
-
if ( Array.isArray( record.mappingInfo ) ) {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
}
|
|
616
|
+
// if ( Array.isArray( record.mappingInfo ) ) {
|
|
617
|
+
// record.mappingInfo = record.mappingInfo.map( ( item ) => {
|
|
618
|
+
// return {
|
|
619
|
+
// ...item,
|
|
620
|
+
// status: 'Closed',
|
|
621
|
+
// };
|
|
622
|
+
// } );
|
|
623
|
+
// }
|
|
595
624
|
|
|
596
625
|
record.mappingInfo.push(
|
|
597
626
|
{
|
|
@@ -606,6 +635,8 @@ export async function tangoReviewAccuracyClosedTicket( req, res ) {
|
|
|
606
635
|
createdByUserName: req?.user?.userName,
|
|
607
636
|
createdByRole: req?.user?.role,
|
|
608
637
|
createdAt: new Date(),
|
|
638
|
+
comments: inputData?.comments || '',
|
|
639
|
+
subComments: inputData?.subComments || '',
|
|
609
640
|
},
|
|
610
641
|
);
|
|
611
642
|
}
|
|
@@ -2209,7 +2240,6 @@ export async function ticketList( req, res ) {
|
|
|
2209
2240
|
const offset = inputData.offset == 0 ? 0 : ( inputData.offset - 1 ) * limit || 0;
|
|
2210
2241
|
inputData.clientId = inputData?.clientId?.split( ',' ); // convert strig to array
|
|
2211
2242
|
|
|
2212
|
-
|
|
2213
2243
|
const ticketsFeature = userInfo?.rolespermission?.some( ( f ) => f.featureName === 'FootfallDirectory' && ( f.modules.find( ( m ) => m.name == 'reviewer' && ( m.isAdd == true || m.isEdit == true ) ) ) );
|
|
2214
2244
|
|
|
2215
2245
|
const ticketsApproveFeature = userInfo?.rolespermission?.some( ( f ) => f.featureName === 'FootfallDirectory' && ( f.modules.find( ( m ) => m.name == 'approver' && ( m.isAdd == true || m.isEdit == true ) ) ) );
|
|
@@ -3034,6 +3064,8 @@ export async function ticketList( req, res ) {
|
|
|
3034
3064
|
'Approver (%)': item?.mappingInfo?.find( ( f ) => f.type === 'approve' )?.revicedPerc || '--',
|
|
3035
3065
|
'Tango (%)': item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '--',
|
|
3036
3066
|
'Status': item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.status || '--',
|
|
3067
|
+
'Comments': item?.mappingInfo?.find( ( f ) => f.type === 'finalRevision' )?.comments || '--',
|
|
3068
|
+
'Sub Comments': item?.mappingInfo?.find( ( f ) => f.type === 'finalRevision' )?.subComments || '--',
|
|
3037
3069
|
|
|
3038
3070
|
} );
|
|
3039
3071
|
}
|
|
@@ -3054,6 +3086,8 @@ export async function ticketList( req, res ) {
|
|
|
3054
3086
|
approverRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'approve' )?.revicedPerc || '--',
|
|
3055
3087
|
tangoRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '--',
|
|
3056
3088
|
status: item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.status || '--',
|
|
3089
|
+
comments: item?.mappingInfo?.find( ( f ) => f.type === 'finalRevision' )?.comments || '--',
|
|
3090
|
+
subComments: item?.mappingInfo?.find( ( f ) => f.type === 'finalRevision' )?.subComments || '--',
|
|
3057
3091
|
|
|
3058
3092
|
} );
|
|
3059
3093
|
}
|
|
@@ -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"
|