tango-app-api-infra 3.9.15 → 3.9.17
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-infra",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.17",
|
|
4
4
|
"description": "infra",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"swagger-ui-express": "^5.0.0",
|
|
30
30
|
"tango-api-schema": "^2.5.19",
|
|
31
31
|
"tango-app-api-infra": "^3.9.5-vms.56",
|
|
32
|
-
"tango-app-api-middleware": "^3.6.
|
|
32
|
+
"tango-app-api-middleware": "^3.6.16",
|
|
33
33
|
"winston": "^3.12.0",
|
|
34
34
|
"winston-daily-rotate-file": "^5.0.0"
|
|
35
35
|
},
|
|
@@ -837,10 +837,22 @@ export async function ticketSummary( req, res ) {
|
|
|
837
837
|
const userInfo = req.user;
|
|
838
838
|
const ticketsFeature = userInfo?.rolespermission?.some( ( f ) => f.featureName === 'FootfallDirectory' && ( f.modules.find( ( m ) => m.name == 'reviewer' && ( m.isAdd == true || m.isEdit == true ) ) ) );
|
|
839
839
|
const ticketsApproveFeature = userInfo?.rolespermission?.some( ( f ) => f.featureName === 'FootfallDirectory' && ( f.modules.find( ( m ) => m.name == 'approver' && ( m.isAdd == true || m.isEdit == true ) ) ) );
|
|
840
|
+
|
|
841
|
+
|
|
840
842
|
const getConfig = await findOneClient( { 'clientId': { $in: inputData?.clientId }, 'featureConfigs.isVMS': true }, { footfallDirectoryConfigs: 1 } );
|
|
841
843
|
if ( !getConfig || getConfig == null ) {
|
|
842
844
|
return res.sendError( 'this client not configured against footfall directory', 400 );
|
|
843
845
|
}
|
|
846
|
+
let isApprover = false;
|
|
847
|
+
revisionArray = getConfig?.footfallDirectoryConfigs?.revision || [];
|
|
848
|
+
if ( Array.isArray( revisionArray ) && revisionArray.length > 0 ) {
|
|
849
|
+
for ( const r of revisionArray ) {
|
|
850
|
+
if ( r.actionType === 'approver' && r.isChecked === false ) {
|
|
851
|
+
isApprover = true;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
|
|
844
856
|
// const ticketsApproveFeature = userInfo?.rolespermission?.some( ( f ) => f.featureName === 'FootfallDirectory' && ( f.modules.find( ( m ) => m.name == 'approver' && ( m.isAdd == true || m.isEdit == true ) ) ) );
|
|
845
857
|
if ( req?.user?.userType === 'tango' ) {
|
|
846
858
|
switch ( inputData?.tangoType ) {
|
|
@@ -1552,6 +1564,13 @@ export async function ticketSummary( req, res ) {
|
|
|
1552
1564
|
expiredTickets = eResp?.body?.hits?.total?.value || 0;
|
|
1553
1565
|
// Calculate average ticket percentage: avg((reviced/footfallCount)*100) filtered by baseStoreQuery
|
|
1554
1566
|
|
|
1567
|
+
|
|
1568
|
+
let undertangoTickets = 0;
|
|
1569
|
+
|
|
1570
|
+
let utrQ = buildStoreQueryWithStatus( baseStoreQuery, [ 'Under Tango Review' ] );
|
|
1571
|
+
utrQ.size = 0;
|
|
1572
|
+
const utrResp = await getOpenSearchData( openSearch.footfallDirectory, utrQ );
|
|
1573
|
+
undertangoTickets = utrResp?.body?.hits?.total?.value || 0;
|
|
1555
1574
|
// Build aggregation query for ticket percentage
|
|
1556
1575
|
let ticketPercentageAvg = 0;
|
|
1557
1576
|
|
|
@@ -1596,6 +1615,7 @@ export async function ticketSummary( req, res ) {
|
|
|
1596
1615
|
closedTickets,
|
|
1597
1616
|
dueToday: dueToday,
|
|
1598
1617
|
Expired: expiredTickets,
|
|
1618
|
+
...( isApprover !== true? underTangoReview: undertangoTickets ),
|
|
1599
1619
|
avgTicket: ticketPercentageAvg + '%',
|
|
1600
1620
|
avgAccuracy: ticketAccuracy + '%',
|
|
1601
1621
|
};
|
|
@@ -2001,6 +2021,13 @@ export async function ticketSummary( req, res ) {
|
|
|
2001
2021
|
const eResp = await getOpenSearchData( openSearch.footfallDirectory, eQ );
|
|
2002
2022
|
expiredTickets = eResp?.body?.hits?.total?.value || 0;
|
|
2003
2023
|
|
|
2024
|
+
let undertangoTickets = 0;
|
|
2025
|
+
|
|
2026
|
+
let utrQ = buildStoreQueryWithStatus( baseStoreQuery, [ 'Under Tango Review' ] );
|
|
2027
|
+
utrQ.size = 0;
|
|
2028
|
+
const utrResp = await getOpenSearchData( openSearch.footfallDirectory, utrQ );
|
|
2029
|
+
undertangoTickets = utrResp?.body?.hits?.total?.value || 0;
|
|
2030
|
+
|
|
2004
2031
|
// Calculate average ticket percentage: avg((reviced/footfallCount)*100) filtered by baseStoreQuery
|
|
2005
2032
|
|
|
2006
2033
|
// Build aggregation query for ticket percentage
|
|
@@ -2046,6 +2073,7 @@ export async function ticketSummary( req, res ) {
|
|
|
2046
2073
|
closedTickets,
|
|
2047
2074
|
dueToday: dueToday,
|
|
2048
2075
|
Expired: expiredTickets,
|
|
2076
|
+
...( isApprover !== true? underTangoReview: undertangoTickets ),
|
|
2049
2077
|
avgTicket: ticketPercentageAvg + '%',
|
|
2050
2078
|
avgAccuracy: ticketAccuracy + '%',
|
|
2051
2079
|
};
|
|
@@ -2521,6 +2549,19 @@ export async function ticketList( req, res ) {
|
|
|
2521
2549
|
|
|
2522
2550
|
const ticketsApproveFeature = userInfo?.rolespermission?.some( ( f ) => f.featureName === 'FootfallDirectory' && ( f.modules.find( ( m ) => m.name == 'approver' && ( m.isAdd == true || m.isEdit == true ) ) ) );
|
|
2523
2551
|
|
|
2552
|
+
const getConfig = await findOneClient( { 'clientId': { $in: inputData?.clientId }, 'featureConfigs.isVMS': true }, { footfallDirectoryConfigs: 1 } );
|
|
2553
|
+
if ( !getConfig || getConfig == null ) {
|
|
2554
|
+
return res.sendError( 'this client not configured against footfall directory', 400 );
|
|
2555
|
+
}
|
|
2556
|
+
let isApprover = false;
|
|
2557
|
+
const revisionArray = getConfig?.footfallDirectoryConfigs?.revision || [];
|
|
2558
|
+
if ( Array.isArray( revisionArray ) && revisionArray.length > 0 ) {
|
|
2559
|
+
for ( const r of revisionArray ) {
|
|
2560
|
+
if ( r.actionType === 'approver' && r.isChecked === false ) {
|
|
2561
|
+
isApprover = true;
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2524
2565
|
const searchQuery = {
|
|
2525
2566
|
|
|
2526
2567
|
size: limit, // or use parseInt(req.query.limit) for dynamic
|
|
@@ -2601,6 +2642,9 @@ export async function ticketList( req, res ) {
|
|
|
2601
2642
|
} else if ( inputData.sortBy === 'approvedBy' ) {
|
|
2602
2643
|
sortKey = 'createdByEmail';
|
|
2603
2644
|
requestedSortType = 'approve';
|
|
2645
|
+
} else if ( inputData.sortBy === 'ticketBy' ) {
|
|
2646
|
+
sortKey = 'createdByEmail';
|
|
2647
|
+
requestedSortType = 'tangoreview';
|
|
2604
2648
|
} else if ( inputData.sortBy === 'status' ) {
|
|
2605
2649
|
sortKey = 'status';
|
|
2606
2650
|
requestedSortType =( req.user.userType === 'tango' && inputData.tangoType === 'store' )? 'tangoreview' : inputData?.permissionType === 'review' ? 'review' : ( ticketsFeature && !ticketsApproveFeature )? 'review':'approve';
|
|
@@ -3796,7 +3840,6 @@ export async function ticketList( req, res ) {
|
|
|
3796
3840
|
// You can add more filters as needed
|
|
3797
3841
|
const searchResult = await getOpenSearchData( openSearch.footfallDirectory, searchQuery );
|
|
3798
3842
|
const count = searchResult?.body?.hits?.total?.value || 0;
|
|
3799
|
-
logger.info( { searchResult, count } );
|
|
3800
3843
|
if ( count === 0 ) {
|
|
3801
3844
|
return res.sendError( 'no data found', 204 );
|
|
3802
3845
|
}
|
|
@@ -3856,6 +3899,7 @@ export async function ticketList( req, res ) {
|
|
|
3856
3899
|
'Reviewer (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
|
|
3857
3900
|
'Approver (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'approve' )?.revicedPerc || '--',
|
|
3858
3901
|
'Tango (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '--',
|
|
3902
|
+
'Ticket By': item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.createdByEmail || '--',
|
|
3859
3903
|
'Status': item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.status || '--',
|
|
3860
3904
|
'Comments': item?.mappingInfo?.find( ( f ) => f.type === 'finalRevision' )?.comments || '--',
|
|
3861
3905
|
'Sub Comments': item?.mappingInfo?.find( ( f ) => f.type === 'finalRevision' )?.subComments || '--',
|
|
@@ -3881,6 +3925,7 @@ export async function ticketList( req, res ) {
|
|
|
3881
3925
|
'status': item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.status || '--',
|
|
3882
3926
|
'comments': item?.mappingInfo?.find( ( f ) => f.type === 'finalRevision' )?.comments || '--',
|
|
3883
3927
|
'subComments': item?.mappingInfo?.find( ( f ) => f.type === 'finalRevision' )?.subComments || '--',
|
|
3928
|
+
'ticketBy': item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.createdByEmail || '--',
|
|
3884
3929
|
|
|
3885
3930
|
} );
|
|
3886
3931
|
}
|
|
@@ -3902,6 +3947,7 @@ export async function ticketList( req, res ) {
|
|
|
3902
3947
|
'Reviewer (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
|
|
3903
3948
|
'Approver (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'approve' )?.revicedPerc || '--',
|
|
3904
3949
|
'Tango (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '--',
|
|
3950
|
+
'Ticket By': item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.createdByEmail || '--',
|
|
3905
3951
|
'Ticket Status': item?.type === 'store' ? item?.status : '',
|
|
3906
3952
|
'Tango Status': item?.type === 'store' ? item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.status || '--' : item.status,
|
|
3907
3953
|
|
|
@@ -3923,6 +3969,7 @@ export async function ticketList( req, res ) {
|
|
|
3923
3969
|
reviewerRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
|
|
3924
3970
|
approverRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'approve' )?.revicedPerc || '--',
|
|
3925
3971
|
tangoRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '--',
|
|
3972
|
+
ticketBy: item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.createdByEmail || '--',
|
|
3926
3973
|
status: item?.type === 'store'?item?.status:'--',
|
|
3927
3974
|
tangoStatus: item?.type === 'internal'? item.status : '--',
|
|
3928
3975
|
} );
|
|
@@ -3941,6 +3988,7 @@ export async function ticketList( req, res ) {
|
|
|
3941
3988
|
'Store ID': item?.storeId,
|
|
3942
3989
|
'Ticket Raised': item?.mappingInfo?.find( ( f ) => f.type === 'approve' )?.createdAt ? dayjs( item?.mappingInfo?.find( ( f ) => f.type === 'approve' )?.createdAt ).format( 'DD MMM, YYYY' ) : '',
|
|
3943
3990
|
'Issue Date': item?.dateString ? dayjs( item.dateString ).format( 'DD MMM, YYYY' ) : '',
|
|
3991
|
+
// 'Closed Date': item?.dateString ? dayjs( item.dateString ).format( 'DD MMM, YYYY' ) : '',
|
|
3944
3992
|
'Due Date': ( () => {
|
|
3945
3993
|
const dueDate = item?.mappingInfo?.find( ( f ) => f.type === 'approve' )?.dueDate;
|
|
3946
3994
|
if ( dueDate ) {
|
|
@@ -3979,6 +4027,7 @@ export async function ticketList( req, res ) {
|
|
|
3979
4027
|
return {};
|
|
3980
4028
|
} )(),
|
|
3981
4029
|
'Actual FF': item?.footfallCount,
|
|
4030
|
+
// 'Revised FF': item?.revicedFootfall,
|
|
3982
4031
|
'Store (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedPerc || '--',
|
|
3983
4032
|
'Reviewer (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
|
|
3984
4033
|
'Approver (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'approve' )?.revicedPerc || '--',
|
|
@@ -4001,6 +4050,7 @@ export async function ticketList( req, res ) {
|
|
|
4001
4050
|
issueDate: item?.dateString,
|
|
4002
4051
|
dueDate: item?.mappingInfo?.find( ( f ) => f.type === 'approve' )?.dueDate,
|
|
4003
4052
|
footfall: item?.footfallCount,
|
|
4053
|
+
// revicedFootfall: item?.revicedFootfall,
|
|
4004
4054
|
type: item.type || 'store',
|
|
4005
4055
|
storeRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedPerc || '--',
|
|
4006
4056
|
reviewerRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
|
|
@@ -4022,9 +4072,9 @@ export async function ticketList( req, res ) {
|
|
|
4022
4072
|
'Ticket ID': item?.ticketId,
|
|
4023
4073
|
'Store Name': item?.storeName,
|
|
4024
4074
|
'Store ID': item?.storeId,
|
|
4025
|
-
'Ticket Raised': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdAt ? dayjs( item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdAt ).format( 'DD MMM, YYYY' ) : '',
|
|
4075
|
+
'Ticket Raised': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdAt ? dayjs( item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdAt ).format( 'DD MMM, YYYY' ) : '--',
|
|
4026
4076
|
'Issue Date': item?.dateString ? dayjs( item.dateString ).format( 'DD MMM, YYYY' ) : '',
|
|
4027
|
-
|
|
4077
|
+
'Ticket Closed Date': item.status === 'Closed' || item.status === 'Tango Review Done' ? dayjs( item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.updatedAt ).format( 'DD MMM, YYYY' ) : '--',
|
|
4028
4078
|
'Due Date': ( () => {
|
|
4029
4079
|
const dueDate = item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.dueDate;
|
|
4030
4080
|
if ( dueDate ) {
|
|
@@ -4063,11 +4113,13 @@ export async function ticketList( req, res ) {
|
|
|
4063
4113
|
return {};
|
|
4064
4114
|
} )(),
|
|
4065
4115
|
'Actual FF': item?.footfallCount,
|
|
4116
|
+
'Revised FF': item.status === 'Closed' || item.status === 'Tango Review Done' ? item?.revicedFootfall : '--',
|
|
4066
4117
|
'Store (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedPerc || '--',
|
|
4067
4118
|
'Reviewer (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
|
|
4119
|
+
...( isApprover !== true? 'Tango (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '--' ),
|
|
4068
4120
|
'Status': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.status || '--',
|
|
4069
4121
|
'Reviewed by': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdByEmail || '--',
|
|
4070
|
-
|
|
4122
|
+
'Created by': item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.createdByEmail || '--',
|
|
4071
4123
|
|
|
4072
4124
|
} );
|
|
4073
4125
|
}
|
|
@@ -4079,6 +4131,7 @@ export async function ticketList( req, res ) {
|
|
|
4079
4131
|
ticketId: item?.ticketId,
|
|
4080
4132
|
storeId: item?.storeId,
|
|
4081
4133
|
storeName: item?.storeName,
|
|
4134
|
+
ticketCreatedBy: item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.createdByEmail || '--',
|
|
4082
4135
|
ticketRaised: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdAt,
|
|
4083
4136
|
issueDate: item?.dateString,
|
|
4084
4137
|
footfall: item?.footfallCount,
|
|
@@ -4086,7 +4139,10 @@ export async function ticketList( req, res ) {
|
|
|
4086
4139
|
type: item.type || 'store',
|
|
4087
4140
|
storeRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedPerc || '--',
|
|
4088
4141
|
reviewerRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
|
|
4142
|
+
...( isApprover !== true? tangoRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '--' ),
|
|
4143
|
+
revicedFootfall: item.status === 'Closed' || item.status === 'Tango Review Done' ?item?.revicedFootfall : '--',
|
|
4089
4144
|
status: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.status || '--',
|
|
4145
|
+
closedDate: item.status === 'Closed' || item.status === 'Tango Review Done' ? item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.updatedAt : '--',
|
|
4090
4146
|
ReviewedBy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdByEmail || '--',
|
|
4091
4147
|
|
|
4092
4148
|
} );
|
|
@@ -4143,9 +4199,10 @@ export async function ticketList( req, res ) {
|
|
|
4143
4199
|
return {};
|
|
4144
4200
|
} )(),
|
|
4145
4201
|
'Actual FF': item?.footfallCount,
|
|
4146
|
-
|
|
4202
|
+
// 'Revised FF': item?.revicedFootfall,
|
|
4147
4203
|
'Store (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedPerc || '--',
|
|
4148
4204
|
'Reviewer (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
|
|
4205
|
+
...( ticketsApproveFeature !== true? 'Tango (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '--' ),
|
|
4149
4206
|
'Status': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.status || '--',
|
|
4150
4207
|
'Reviewed by': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdByEmail || '--',
|
|
4151
4208
|
|
|
@@ -4162,10 +4219,12 @@ export async function ticketList( req, res ) {
|
|
|
4162
4219
|
ticketRaised: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdAt,
|
|
4163
4220
|
issueDate: item?.dateString,
|
|
4164
4221
|
footfall: item?.footfallCount,
|
|
4222
|
+
// revicedFootfall: item?.revicedFootfall,
|
|
4165
4223
|
dueDate: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.dueDate,
|
|
4166
4224
|
type: item.type || 'store',
|
|
4167
4225
|
storeRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedPerc || '--',
|
|
4168
4226
|
reviewerRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
|
|
4227
|
+
...( isApprover !== true? tangoRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '--' ),
|
|
4169
4228
|
status: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.status || '--',
|
|
4170
4229
|
ReviewedBy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdByEmail || '--',
|
|
4171
4230
|
|
|
@@ -4221,6 +4280,7 @@ export async function ticketList( req, res ) {
|
|
|
4221
4280
|
return {};
|
|
4222
4281
|
} )(),
|
|
4223
4282
|
'Actual FF': item?.footfallCount,
|
|
4283
|
+
'Revised FF': item?.revicedFootfall,
|
|
4224
4284
|
'Store (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedPerc || '--',
|
|
4225
4285
|
'Reviewer (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
|
|
4226
4286
|
'Approver (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'approve' )?.revicedPerc || '--',
|
|
@@ -4243,6 +4303,7 @@ export async function ticketList( req, res ) {
|
|
|
4243
4303
|
issueDate: item?.dateString,
|
|
4244
4304
|
dueDate: item?.mappingInfo?.find( ( f ) => f.type === 'approve' )?.dueDate,
|
|
4245
4305
|
footfall: item?.footfallCount,
|
|
4306
|
+
revicedFootfall: item?.revicedFootfall,
|
|
4246
4307
|
type: item.type || 'store',
|
|
4247
4308
|
storeRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedPerc || '--',
|
|
4248
4309
|
reviewerRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
|
|
@@ -556,6 +556,7 @@ export async function ticketCreation( req, res, next ) {
|
|
|
556
556
|
createdByEmail: req?.user?.email,
|
|
557
557
|
createdByUserName: req?.user?.userName,
|
|
558
558
|
createdByRole: req?.user?.role,
|
|
559
|
+
isUp: false,
|
|
559
560
|
createdAt: new Date(),
|
|
560
561
|
},
|
|
561
562
|
],
|
|
@@ -590,6 +591,7 @@ export async function ticketCreation( req, res, next ) {
|
|
|
590
591
|
createdByEmail: req?.user?.email,
|
|
591
592
|
createdByUserName: req?.user?.userName,
|
|
592
593
|
createdByRole: req?.user?.role,
|
|
594
|
+
isUp: false,
|
|
593
595
|
updatedAt: new Date(),
|
|
594
596
|
},
|
|
595
597
|
{
|
|
@@ -604,6 +606,7 @@ export async function ticketCreation( req, res, next ) {
|
|
|
604
606
|
createdByEmail: req?.user?.email,
|
|
605
607
|
createdByUserName: req?.user?.userName,
|
|
606
608
|
createdByRole: req?.user?.role,
|
|
609
|
+
isUp: false,
|
|
607
610
|
updatedAt: new Date(),
|
|
608
611
|
},
|
|
609
612
|
];
|
|
@@ -733,7 +736,7 @@ export async function ticketCreation( req, res, next ) {
|
|
|
733
736
|
|
|
734
737
|
const id = `${inputData.storeId}_${inputData.dateString}_footfall-directory-tagging`;
|
|
735
738
|
const insertResult = await insertWithId( openSearch.footfallDirectory, id, record );
|
|
736
|
-
if ( insertResult && insertResult.statusCode === 201 ) {
|
|
739
|
+
if ( insertResult && ( insertResult.statusCode === 201 || insertResult.statusCode === 200 ) ) {
|
|
737
740
|
// After successful ticket creation, update status to "submitted" in revop index for the relevant records
|
|
738
741
|
|
|
739
742
|
|
|
@@ -773,6 +776,13 @@ export async function ticketCreation( req, res, next ) {
|
|
|
773
776
|
},
|
|
774
777
|
},
|
|
775
778
|
],
|
|
779
|
+
must_not: [
|
|
780
|
+
{
|
|
781
|
+
term: {
|
|
782
|
+
'revopsType.keyword': 'non-tagging',
|
|
783
|
+
},
|
|
784
|
+
},
|
|
785
|
+
],
|
|
776
786
|
},
|
|
777
787
|
},
|
|
778
788
|
_source: [ 'tempId' ],
|
|
@@ -1348,6 +1358,9 @@ export async function ticketReview( req, res, next ) {
|
|
|
1348
1358
|
// createdByRole: req?.user?.role,
|
|
1349
1359
|
|
|
1350
1360
|
};
|
|
1361
|
+
const getTagging = ticketData?.[0]?._source?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedFootfall;
|
|
1362
|
+
const taggingRevised = getTagging ?? 0;
|
|
1363
|
+
|
|
1351
1364
|
|
|
1352
1365
|
if ( Array.isArray( record.mappingInfo ) ) {
|
|
1353
1366
|
const temp = record.mappingInfo
|
|
@@ -1364,6 +1377,8 @@ export async function ticketReview( req, res, next ) {
|
|
|
1364
1377
|
createdByEmail: req?.user?.email,
|
|
1365
1378
|
createdByUserName: req?.user?.userName,
|
|
1366
1379
|
createdByRole: req?.user?.role,
|
|
1380
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1381
|
+
updatedAt: new Date(),
|
|
1367
1382
|
} ) );
|
|
1368
1383
|
record.mappingInfo = [ ticketData?.[0]?._source?.mappingInfo[0], ...temp ];
|
|
1369
1384
|
// If no review mapping existed, push a new one
|
|
@@ -1380,6 +1395,8 @@ export async function ticketReview( req, res, next ) {
|
|
|
1380
1395
|
createdByEmail: req?.user?.email,
|
|
1381
1396
|
createdByUserName: req?.user?.userName,
|
|
1382
1397
|
createdByRole: req?.user?.role,
|
|
1398
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1399
|
+
updatedAt: new Date(),
|
|
1383
1400
|
} );
|
|
1384
1401
|
}
|
|
1385
1402
|
}
|
|
@@ -1417,6 +1434,8 @@ export async function ticketReview( req, res, next ) {
|
|
|
1417
1434
|
createdByEmail: req?.user?.email,
|
|
1418
1435
|
createdByUserName: req?.user?.userName,
|
|
1419
1436
|
createdByRole: req?.user?.role,
|
|
1437
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1438
|
+
updatedAt: new Date(),
|
|
1420
1439
|
} ) );
|
|
1421
1440
|
|
|
1422
1441
|
const temp2 = record.mappingInfo
|
|
@@ -1442,6 +1461,8 @@ export async function ticketReview( req, res, next ) {
|
|
|
1442
1461
|
createdByEmail: req?.user?.email,
|
|
1443
1462
|
createdByUserName: req?.user?.userName,
|
|
1444
1463
|
createdByRole: req?.user?.role,
|
|
1464
|
+
updatedAt: new Date(),
|
|
1465
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1445
1466
|
} );
|
|
1446
1467
|
}
|
|
1447
1468
|
}
|
|
@@ -1460,6 +1481,7 @@ export async function ticketReview( req, res, next ) {
|
|
|
1460
1481
|
createdByRole: req?.user?.role,
|
|
1461
1482
|
createdAt: new Date(),
|
|
1462
1483
|
updatedAt: new Date(),
|
|
1484
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1463
1485
|
},
|
|
1464
1486
|
);
|
|
1465
1487
|
} else {
|
|
@@ -1510,6 +1532,7 @@ export async function ticketReview( req, res, next ) {
|
|
|
1510
1532
|
createdByUserName: req?.user?.userName,
|
|
1511
1533
|
createdByRole: req?.user?.role,
|
|
1512
1534
|
updatedAt: new Date(),
|
|
1535
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1513
1536
|
} ) );
|
|
1514
1537
|
|
|
1515
1538
|
record.mappingInfo = [ ...ticketData?.[0]?._source?.mappingInfo.slice( 0, -1 ),
|
|
@@ -1529,6 +1552,7 @@ export async function ticketReview( req, res, next ) {
|
|
|
1529
1552
|
createdByEmail: req?.user?.email,
|
|
1530
1553
|
createdByUserName: req?.user?.userName,
|
|
1531
1554
|
createdByRole: req?.user?.role,
|
|
1555
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1532
1556
|
updatedAt: new Date(),
|
|
1533
1557
|
} );
|
|
1534
1558
|
}
|
|
@@ -1567,6 +1591,8 @@ export async function ticketReview( req, res, next ) {
|
|
|
1567
1591
|
createdByEmail: req?.user?.email,
|
|
1568
1592
|
createdByUserName: req?.user?.userName,
|
|
1569
1593
|
createdByRole: req?.user?.role,
|
|
1594
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1595
|
+
updatedAt: new Date(),
|
|
1570
1596
|
} ) );
|
|
1571
1597
|
|
|
1572
1598
|
const temp2 = record.mappingInfo
|
|
@@ -1592,6 +1618,8 @@ export async function ticketReview( req, res, next ) {
|
|
|
1592
1618
|
createdByEmail: req?.user?.email,
|
|
1593
1619
|
createdByUserName: req?.user?.userName,
|
|
1594
1620
|
createdByRole: req?.user?.role,
|
|
1621
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1622
|
+
updatedAt: new Date(),
|
|
1595
1623
|
} );
|
|
1596
1624
|
}
|
|
1597
1625
|
}
|
|
@@ -1608,6 +1636,7 @@ export async function ticketReview( req, res, next ) {
|
|
|
1608
1636
|
createdByEmail: req?.user?.email,
|
|
1609
1637
|
createdByUserName: req?.user?.userName,
|
|
1610
1638
|
createdByRole: req?.user?.role,
|
|
1639
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1611
1640
|
createdAt: new Date(),
|
|
1612
1641
|
updatedAt: new Date(),
|
|
1613
1642
|
},
|
|
@@ -1641,6 +1670,8 @@ export async function ticketReview( req, res, next ) {
|
|
|
1641
1670
|
createdByEmail: req?.user?.email,
|
|
1642
1671
|
createdByUserName: req?.user?.userName,
|
|
1643
1672
|
createdByRole: req?.user?.role,
|
|
1673
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1674
|
+
updatedAt: new Date(),
|
|
1644
1675
|
} ) );
|
|
1645
1676
|
|
|
1646
1677
|
const temp2 = record.mappingInfo
|
|
@@ -1666,6 +1697,8 @@ export async function ticketReview( req, res, next ) {
|
|
|
1666
1697
|
createdByEmail: req?.user?.email,
|
|
1667
1698
|
createdByUserName: req?.user?.userName,
|
|
1668
1699
|
createdByRole: req?.user?.role,
|
|
1700
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1701
|
+
updatedAt: new Date(),
|
|
1669
1702
|
} );
|
|
1670
1703
|
}
|
|
1671
1704
|
}
|
|
@@ -1684,6 +1717,7 @@ export async function ticketReview( req, res, next ) {
|
|
|
1684
1717
|
createdByRole: req?.user?.role,
|
|
1685
1718
|
createdAt: new Date(),
|
|
1686
1719
|
updatedAt: new Date(),
|
|
1720
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1687
1721
|
},
|
|
1688
1722
|
);
|
|
1689
1723
|
}
|
|
@@ -2197,6 +2231,9 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2197
2231
|
|
|
2198
2232
|
};
|
|
2199
2233
|
|
|
2234
|
+
const getReview = ticketData?.[0]?._source?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedFootfall;
|
|
2235
|
+
const reviewRevised = getReview ?? 0;
|
|
2236
|
+
|
|
2200
2237
|
|
|
2201
2238
|
// Retrieve client footfallDirectoryConfigs revision
|
|
2202
2239
|
let isAutoCloseEnable = getConfig.footfallDirectoryConfigs.isAutoCloseEnable;
|
|
@@ -2234,6 +2271,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2234
2271
|
createdByEmail: req?.user?.email,
|
|
2235
2272
|
createdByUserName: req?.user?.userName,
|
|
2236
2273
|
createdByRole: req?.user?.role,
|
|
2274
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2237
2275
|
updatedAt: new Date(),
|
|
2238
2276
|
// createdAt: new Date(),
|
|
2239
2277
|
} ) );
|
|
@@ -2264,6 +2302,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2264
2302
|
createdByEmail: req?.user?.email,
|
|
2265
2303
|
createdByUserName: req?.user?.userName,
|
|
2266
2304
|
createdByRole: req?.user?.role,
|
|
2305
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2267
2306
|
updatedAt: new Date(),
|
|
2268
2307
|
} );
|
|
2269
2308
|
}
|
|
@@ -2281,6 +2320,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2281
2320
|
createdByEmail: req?.user?.email,
|
|
2282
2321
|
createdByUserName: req?.user?.userName,
|
|
2283
2322
|
createdByRole: req?.user?.role,
|
|
2323
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2284
2324
|
createdAt: new Date(),
|
|
2285
2325
|
},
|
|
2286
2326
|
);
|
|
@@ -2305,6 +2345,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2305
2345
|
createdByEmail: req?.user?.email,
|
|
2306
2346
|
createdByUserName: req?.user?.userName,
|
|
2307
2347
|
createdByRole: req?.user?.role,
|
|
2348
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2308
2349
|
updatedAt: new Date(),
|
|
2309
2350
|
} ) );
|
|
2310
2351
|
|
|
@@ -2325,6 +2366,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2325
2366
|
createdByEmail: req?.user?.email,
|
|
2326
2367
|
createdByUserName: req?.user?.userName,
|
|
2327
2368
|
createdByRole: req?.user?.role,
|
|
2369
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2328
2370
|
updatedAt: new Date(),
|
|
2329
2371
|
} );
|
|
2330
2372
|
}
|
|
@@ -2364,6 +2406,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2364
2406
|
createdByEmail: req?.user?.email,
|
|
2365
2407
|
createdByUserName: req?.user?.userName,
|
|
2366
2408
|
createdByRole: req?.user?.role,
|
|
2409
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2367
2410
|
updatedAt: new Date(),
|
|
2368
2411
|
} ) );
|
|
2369
2412
|
|
|
@@ -2391,6 +2434,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2391
2434
|
createdByEmail: req?.user?.email,
|
|
2392
2435
|
createdByUserName: req?.user?.userName,
|
|
2393
2436
|
createdByRole: req?.user?.role,
|
|
2437
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2394
2438
|
updatedAt: new Date(),
|
|
2395
2439
|
} );
|
|
2396
2440
|
}
|
|
@@ -2408,6 +2452,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2408
2452
|
createdByEmail: req?.user?.email,
|
|
2409
2453
|
createdByUserName: req?.user?.userName,
|
|
2410
2454
|
createdByRole: req?.user?.role,
|
|
2455
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2411
2456
|
createdAt: new Date(),
|
|
2412
2457
|
updatedAt: new Date(),
|
|
2413
2458
|
},
|
|
@@ -2448,6 +2493,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2448
2493
|
createdByEmail: req?.user?.email,
|
|
2449
2494
|
createdByUserName: req?.user?.userName,
|
|
2450
2495
|
createdByRole: req?.user?.role,
|
|
2496
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2451
2497
|
updatedAt: new Date(),
|
|
2452
2498
|
} ) );
|
|
2453
2499
|
|
|
@@ -2475,6 +2521,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2475
2521
|
createdByEmail: req?.user?.email,
|
|
2476
2522
|
createdByUserName: req?.user?.userName,
|
|
2477
2523
|
createdByRole: req?.user?.role,
|
|
2524
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2478
2525
|
updatedAt: new Date(),
|
|
2479
2526
|
} );
|
|
2480
2527
|
}
|
|
@@ -2492,6 +2539,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2492
2539
|
createdByEmail: req?.user?.email,
|
|
2493
2540
|
createdByUserName: req?.user?.userName,
|
|
2494
2541
|
createdByRole: req?.user?.role,
|
|
2542
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2495
2543
|
createdAt: new Date(),
|
|
2496
2544
|
updatedAt: new Date(),
|
|
2497
2545
|
},
|