tango-app-api-infra 3.9.16 → 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
|
|
|
@@ -1355,6 +1358,9 @@ export async function ticketReview( req, res, next ) {
|
|
|
1355
1358
|
// createdByRole: req?.user?.role,
|
|
1356
1359
|
|
|
1357
1360
|
};
|
|
1361
|
+
const getTagging = ticketData?.[0]?._source?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedFootfall;
|
|
1362
|
+
const taggingRevised = getTagging ?? 0;
|
|
1363
|
+
|
|
1358
1364
|
|
|
1359
1365
|
if ( Array.isArray( record.mappingInfo ) ) {
|
|
1360
1366
|
const temp = record.mappingInfo
|
|
@@ -1371,6 +1377,8 @@ export async function ticketReview( req, res, next ) {
|
|
|
1371
1377
|
createdByEmail: req?.user?.email,
|
|
1372
1378
|
createdByUserName: req?.user?.userName,
|
|
1373
1379
|
createdByRole: req?.user?.role,
|
|
1380
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1381
|
+
updatedAt: new Date(),
|
|
1374
1382
|
} ) );
|
|
1375
1383
|
record.mappingInfo = [ ticketData?.[0]?._source?.mappingInfo[0], ...temp ];
|
|
1376
1384
|
// If no review mapping existed, push a new one
|
|
@@ -1387,6 +1395,8 @@ export async function ticketReview( req, res, next ) {
|
|
|
1387
1395
|
createdByEmail: req?.user?.email,
|
|
1388
1396
|
createdByUserName: req?.user?.userName,
|
|
1389
1397
|
createdByRole: req?.user?.role,
|
|
1398
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1399
|
+
updatedAt: new Date(),
|
|
1390
1400
|
} );
|
|
1391
1401
|
}
|
|
1392
1402
|
}
|
|
@@ -1424,6 +1434,8 @@ export async function ticketReview( req, res, next ) {
|
|
|
1424
1434
|
createdByEmail: req?.user?.email,
|
|
1425
1435
|
createdByUserName: req?.user?.userName,
|
|
1426
1436
|
createdByRole: req?.user?.role,
|
|
1437
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1438
|
+
updatedAt: new Date(),
|
|
1427
1439
|
} ) );
|
|
1428
1440
|
|
|
1429
1441
|
const temp2 = record.mappingInfo
|
|
@@ -1449,6 +1461,8 @@ export async function ticketReview( req, res, next ) {
|
|
|
1449
1461
|
createdByEmail: req?.user?.email,
|
|
1450
1462
|
createdByUserName: req?.user?.userName,
|
|
1451
1463
|
createdByRole: req?.user?.role,
|
|
1464
|
+
updatedAt: new Date(),
|
|
1465
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1452
1466
|
} );
|
|
1453
1467
|
}
|
|
1454
1468
|
}
|
|
@@ -1467,6 +1481,7 @@ export async function ticketReview( req, res, next ) {
|
|
|
1467
1481
|
createdByRole: req?.user?.role,
|
|
1468
1482
|
createdAt: new Date(),
|
|
1469
1483
|
updatedAt: new Date(),
|
|
1484
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1470
1485
|
},
|
|
1471
1486
|
);
|
|
1472
1487
|
} else {
|
|
@@ -1517,6 +1532,7 @@ export async function ticketReview( req, res, next ) {
|
|
|
1517
1532
|
createdByUserName: req?.user?.userName,
|
|
1518
1533
|
createdByRole: req?.user?.role,
|
|
1519
1534
|
updatedAt: new Date(),
|
|
1535
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1520
1536
|
} ) );
|
|
1521
1537
|
|
|
1522
1538
|
record.mappingInfo = [ ...ticketData?.[0]?._source?.mappingInfo.slice( 0, -1 ),
|
|
@@ -1536,6 +1552,7 @@ export async function ticketReview( req, res, next ) {
|
|
|
1536
1552
|
createdByEmail: req?.user?.email,
|
|
1537
1553
|
createdByUserName: req?.user?.userName,
|
|
1538
1554
|
createdByRole: req?.user?.role,
|
|
1555
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1539
1556
|
updatedAt: new Date(),
|
|
1540
1557
|
} );
|
|
1541
1558
|
}
|
|
@@ -1574,6 +1591,8 @@ export async function ticketReview( req, res, next ) {
|
|
|
1574
1591
|
createdByEmail: req?.user?.email,
|
|
1575
1592
|
createdByUserName: req?.user?.userName,
|
|
1576
1593
|
createdByRole: req?.user?.role,
|
|
1594
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1595
|
+
updatedAt: new Date(),
|
|
1577
1596
|
} ) );
|
|
1578
1597
|
|
|
1579
1598
|
const temp2 = record.mappingInfo
|
|
@@ -1599,6 +1618,8 @@ export async function ticketReview( req, res, next ) {
|
|
|
1599
1618
|
createdByEmail: req?.user?.email,
|
|
1600
1619
|
createdByUserName: req?.user?.userName,
|
|
1601
1620
|
createdByRole: req?.user?.role,
|
|
1621
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1622
|
+
updatedAt: new Date(),
|
|
1602
1623
|
} );
|
|
1603
1624
|
}
|
|
1604
1625
|
}
|
|
@@ -1615,6 +1636,7 @@ export async function ticketReview( req, res, next ) {
|
|
|
1615
1636
|
createdByEmail: req?.user?.email,
|
|
1616
1637
|
createdByUserName: req?.user?.userName,
|
|
1617
1638
|
createdByRole: req?.user?.role,
|
|
1639
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1618
1640
|
createdAt: new Date(),
|
|
1619
1641
|
updatedAt: new Date(),
|
|
1620
1642
|
},
|
|
@@ -1648,6 +1670,8 @@ export async function ticketReview( req, res, next ) {
|
|
|
1648
1670
|
createdByEmail: req?.user?.email,
|
|
1649
1671
|
createdByUserName: req?.user?.userName,
|
|
1650
1672
|
createdByRole: req?.user?.role,
|
|
1673
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1674
|
+
updatedAt: new Date(),
|
|
1651
1675
|
} ) );
|
|
1652
1676
|
|
|
1653
1677
|
const temp2 = record.mappingInfo
|
|
@@ -1673,6 +1697,8 @@ export async function ticketReview( req, res, next ) {
|
|
|
1673
1697
|
createdByEmail: req?.user?.email,
|
|
1674
1698
|
createdByUserName: req?.user?.userName,
|
|
1675
1699
|
createdByRole: req?.user?.role,
|
|
1700
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1701
|
+
updatedAt: new Date(),
|
|
1676
1702
|
} );
|
|
1677
1703
|
}
|
|
1678
1704
|
}
|
|
@@ -1691,6 +1717,7 @@ export async function ticketReview( req, res, next ) {
|
|
|
1691
1717
|
createdByRole: req?.user?.role,
|
|
1692
1718
|
createdAt: new Date(),
|
|
1693
1719
|
updatedAt: new Date(),
|
|
1720
|
+
isUp: taggingRevised < revisedFootfall? true : false,
|
|
1694
1721
|
},
|
|
1695
1722
|
);
|
|
1696
1723
|
}
|
|
@@ -2204,6 +2231,9 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2204
2231
|
|
|
2205
2232
|
};
|
|
2206
2233
|
|
|
2234
|
+
const getReview = ticketData?.[0]?._source?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedFootfall;
|
|
2235
|
+
const reviewRevised = getReview ?? 0;
|
|
2236
|
+
|
|
2207
2237
|
|
|
2208
2238
|
// Retrieve client footfallDirectoryConfigs revision
|
|
2209
2239
|
let isAutoCloseEnable = getConfig.footfallDirectoryConfigs.isAutoCloseEnable;
|
|
@@ -2241,6 +2271,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2241
2271
|
createdByEmail: req?.user?.email,
|
|
2242
2272
|
createdByUserName: req?.user?.userName,
|
|
2243
2273
|
createdByRole: req?.user?.role,
|
|
2274
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2244
2275
|
updatedAt: new Date(),
|
|
2245
2276
|
// createdAt: new Date(),
|
|
2246
2277
|
} ) );
|
|
@@ -2271,6 +2302,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2271
2302
|
createdByEmail: req?.user?.email,
|
|
2272
2303
|
createdByUserName: req?.user?.userName,
|
|
2273
2304
|
createdByRole: req?.user?.role,
|
|
2305
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2274
2306
|
updatedAt: new Date(),
|
|
2275
2307
|
} );
|
|
2276
2308
|
}
|
|
@@ -2288,6 +2320,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2288
2320
|
createdByEmail: req?.user?.email,
|
|
2289
2321
|
createdByUserName: req?.user?.userName,
|
|
2290
2322
|
createdByRole: req?.user?.role,
|
|
2323
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2291
2324
|
createdAt: new Date(),
|
|
2292
2325
|
},
|
|
2293
2326
|
);
|
|
@@ -2312,6 +2345,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2312
2345
|
createdByEmail: req?.user?.email,
|
|
2313
2346
|
createdByUserName: req?.user?.userName,
|
|
2314
2347
|
createdByRole: req?.user?.role,
|
|
2348
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2315
2349
|
updatedAt: new Date(),
|
|
2316
2350
|
} ) );
|
|
2317
2351
|
|
|
@@ -2332,6 +2366,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2332
2366
|
createdByEmail: req?.user?.email,
|
|
2333
2367
|
createdByUserName: req?.user?.userName,
|
|
2334
2368
|
createdByRole: req?.user?.role,
|
|
2369
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2335
2370
|
updatedAt: new Date(),
|
|
2336
2371
|
} );
|
|
2337
2372
|
}
|
|
@@ -2371,6 +2406,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2371
2406
|
createdByEmail: req?.user?.email,
|
|
2372
2407
|
createdByUserName: req?.user?.userName,
|
|
2373
2408
|
createdByRole: req?.user?.role,
|
|
2409
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2374
2410
|
updatedAt: new Date(),
|
|
2375
2411
|
} ) );
|
|
2376
2412
|
|
|
@@ -2398,6 +2434,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2398
2434
|
createdByEmail: req?.user?.email,
|
|
2399
2435
|
createdByUserName: req?.user?.userName,
|
|
2400
2436
|
createdByRole: req?.user?.role,
|
|
2437
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2401
2438
|
updatedAt: new Date(),
|
|
2402
2439
|
} );
|
|
2403
2440
|
}
|
|
@@ -2415,6 +2452,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2415
2452
|
createdByEmail: req?.user?.email,
|
|
2416
2453
|
createdByUserName: req?.user?.userName,
|
|
2417
2454
|
createdByRole: req?.user?.role,
|
|
2455
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2418
2456
|
createdAt: new Date(),
|
|
2419
2457
|
updatedAt: new Date(),
|
|
2420
2458
|
},
|
|
@@ -2455,6 +2493,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2455
2493
|
createdByEmail: req?.user?.email,
|
|
2456
2494
|
createdByUserName: req?.user?.userName,
|
|
2457
2495
|
createdByRole: req?.user?.role,
|
|
2496
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2458
2497
|
updatedAt: new Date(),
|
|
2459
2498
|
} ) );
|
|
2460
2499
|
|
|
@@ -2482,6 +2521,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2482
2521
|
createdByEmail: req?.user?.email,
|
|
2483
2522
|
createdByUserName: req?.user?.userName,
|
|
2484
2523
|
createdByRole: req?.user?.role,
|
|
2524
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2485
2525
|
updatedAt: new Date(),
|
|
2486
2526
|
} );
|
|
2487
2527
|
}
|
|
@@ -2499,6 +2539,7 @@ export async function ticketApprove( req, res, next ) {
|
|
|
2499
2539
|
createdByEmail: req?.user?.email,
|
|
2500
2540
|
createdByUserName: req?.user?.userName,
|
|
2501
2541
|
createdByRole: req?.user?.role,
|
|
2542
|
+
isUp: reviewRevised < revisedFootfall ? true : false,
|
|
2502
2543
|
createdAt: new Date(),
|
|
2503
2544
|
updatedAt: new Date(),
|
|
2504
2545
|
},
|