tango-app-api-infra 3.9.5-vms.66 → 3.9.5-vms.67
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,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-infra",
|
|
3
|
-
"version": "3.9.5-vms.
|
|
3
|
+
"version": "3.9.5-vms.67",
|
|
4
4
|
"description": "infra",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"start": "nodemon --exec \"eslint --fix . && node
|
|
8
|
+
"start": "nodemon --exec \"eslint --fix . && node app.js\""
|
|
9
9
|
},
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=18.10.0"
|
|
@@ -157,7 +157,7 @@ export async function tangoReviewTicket( req, res ) {
|
|
|
157
157
|
};
|
|
158
158
|
let findTicket = await getOpenSearchData( openSearch.footfallDirectory, findQuery );
|
|
159
159
|
let Ticket = findTicket.body?.hits?.hits;
|
|
160
|
-
|
|
160
|
+
|
|
161
161
|
if ( Ticket.length === 0 ) {
|
|
162
162
|
return res.sendError( 'Ticket not found', 400 );
|
|
163
163
|
}
|
|
@@ -255,20 +255,20 @@ export async function tangoReviewTicket( req, res ) {
|
|
|
255
255
|
} );
|
|
256
256
|
}
|
|
257
257
|
// If no review mapping existed, push a new one
|
|
258
|
-
if ( record.mappingInfo.length === 0 ) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
258
|
+
// if ( record.mappingInfo.length === 0 ) {
|
|
259
|
+
// record.mappingInfo.push( {
|
|
260
|
+
// type: 'tangoreview',
|
|
261
|
+
// mode: inputData.mappingInfo?.mode,
|
|
262
|
+
// revicedFootfall: inputData.mappingInfo?.revicedFootfall,
|
|
263
|
+
// revicedPerc: inputData.mappingInfo?.revicedPerc,
|
|
264
|
+
// count: inputData.mappingInfo?.count,
|
|
265
|
+
// revisedDetail: inputData.mappingInfo?.revisedDetail,
|
|
266
|
+
// status: 'Closed',
|
|
267
|
+
// createdByEmail: req?.user?.email,
|
|
268
|
+
// createdByUserName: req?.user?.userName,
|
|
269
|
+
// createdByRole: req?.user?.role,
|
|
270
|
+
// } );
|
|
271
|
+
// }
|
|
272
272
|
}
|
|
273
273
|
record.mappingInfo.push(
|
|
274
274
|
{
|
|
@@ -317,20 +317,20 @@ export async function tangoReviewTicket( req, res ) {
|
|
|
317
317
|
} );
|
|
318
318
|
}
|
|
319
319
|
// If no review mapping existed, push a new one
|
|
320
|
-
if ( record.mappingInfo.length === 0 ) {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
320
|
+
// if ( record.mappingInfo.length === 0 ) {
|
|
321
|
+
// record.mappingInfo.push( {
|
|
322
|
+
// type: 'tangoreview',
|
|
323
|
+
// mode: inputData.mappingInfo?.mode,
|
|
324
|
+
// revicedFootfall: inputData.mappingInfo?.revicedFootfall,
|
|
325
|
+
// revicedPerc: inputData.mappingInfo?.revicedPerc,
|
|
326
|
+
// count: inputData.mappingInfo?.count,
|
|
327
|
+
// revisedDetail: inputData.mappingInfo?.revisedDetail,
|
|
328
|
+
// status: 'Closed',
|
|
329
|
+
// createdByEmail: req?.user?.email,
|
|
330
|
+
// createdByUserName: req?.user?.userName,
|
|
331
|
+
// createdByRole: req?.user?.role,
|
|
332
|
+
// } );
|
|
333
|
+
// }
|
|
334
334
|
}
|
|
335
335
|
} else {
|
|
336
336
|
if ( Array.isArray( record.mappingInfo ) ) {
|
|
@@ -393,23 +393,28 @@ export async function tangoReviewTicket( req, res ) {
|
|
|
393
393
|
}
|
|
394
394
|
|
|
395
395
|
if ( Ticket[0]?._source?.type==='store' ) {
|
|
396
|
-
let
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
'
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
396
|
+
let findTagging = Ticket[0]?._source?.mappingInfo.filter( ( data ) => data.type==='tagging' );
|
|
397
|
+
console.log( '🚀 ~ tangoReviewTicket ~ findTgging:', findTagging[0] );
|
|
398
|
+
if ( findTagging?.length>0&&findTagging[0].createdByEmail!='' ) {
|
|
399
|
+
console.log( '🚀 ~ tangoReviewTicket ~ findTgging.mappingInfo[0]?.createdByEmail:', findTagging[0]?.createdByEmail );
|
|
400
|
+
let userData = await findOneUser( { email: findTagging[0]?.createdByEmail } );
|
|
401
|
+
let title = `Received response for the Footfall ticket raised.`;
|
|
402
|
+
let createdOn = dayjs( Ticket[0]?._source?.dateString ).format( 'DD MMM YYYY' );
|
|
403
|
+
let description = `Raised on ${createdOn}`;
|
|
404
|
+
|
|
405
|
+
let Data = {
|
|
406
|
+
'title': title,
|
|
407
|
+
'body': description,
|
|
408
|
+
'type': 'closed',
|
|
409
|
+
'date': Ticket[0]?._source?.dateString,
|
|
410
|
+
'storeId': Ticket[0]?._source?.storeId,
|
|
411
|
+
'clientId': Ticket[0]?._source?.clientId,
|
|
412
|
+
'ticketId': Ticket[0]?._source?.ticketId,
|
|
413
|
+
};
|
|
414
|
+
if ( userData && userData.fcmToken ) {
|
|
415
|
+
const fcmToken = userData.fcmToken;
|
|
416
|
+
await sendPushNotification( title, description, fcmToken, Data );
|
|
417
|
+
}
|
|
413
418
|
}
|
|
414
419
|
}
|
|
415
420
|
// return;
|
|
@@ -870,6 +875,7 @@ export async function ticketList( req, res ) {
|
|
|
870
875
|
const offset = inputData.offset == 0 ? 0 : ( inputData.offset - 1 ) * limit || 0;
|
|
871
876
|
inputData.clientId = inputData?.clientId?.split( ',' ); // convert strig to array
|
|
872
877
|
|
|
878
|
+
|
|
873
879
|
const ticketsFeature = userInfo?.rolespermission?.some( ( f ) => f.featureName === 'FootfallDirectory' && ( f.modules.find( ( m ) => m.name == 'reviewer' && ( m.isAdd == true || m.isEdit == true ) ) ) );
|
|
874
880
|
|
|
875
881
|
const ticketsApproveFeature = userInfo?.rolespermission?.some( ( f ) => f.featureName === 'FootfallDirectory' && ( f.modules.find( ( m ) => m.name == 'approver' && ( m.isAdd == true || m.isEdit == true ) ) ) );
|
|
@@ -934,6 +940,106 @@ export async function ticketList( req, res ) {
|
|
|
934
940
|
},
|
|
935
941
|
} );
|
|
936
942
|
}
|
|
943
|
+
if ( inputData.status ) {
|
|
944
|
+
inputData.status = inputData?.status?.split( ',' );
|
|
945
|
+
if ( req.user.userType === 'tango' ) {
|
|
946
|
+
searchQuery.query.bool.must.push( {
|
|
947
|
+
terms: {
|
|
948
|
+
'status': Array.isArray( inputData?.status ) ?
|
|
949
|
+
inputData?.status :
|
|
950
|
+
[ inputData?.status ],
|
|
951
|
+
},
|
|
952
|
+
} );
|
|
953
|
+
} else if ( inputData?.permissionType === 'approve' ) {
|
|
954
|
+
searchQuery.query.bool.must.push( {
|
|
955
|
+
nested: {
|
|
956
|
+
path: 'mappingInfo',
|
|
957
|
+
query: {
|
|
958
|
+
bool: {
|
|
959
|
+
must: [
|
|
960
|
+
{
|
|
961
|
+
term: {
|
|
962
|
+
'mappingInfo.type': 'approve',
|
|
963
|
+
},
|
|
964
|
+
},
|
|
965
|
+
{
|
|
966
|
+
term: {
|
|
967
|
+
'mappingInfo.status': inputData.status[0],
|
|
968
|
+
},
|
|
969
|
+
},
|
|
970
|
+
],
|
|
971
|
+
},
|
|
972
|
+
},
|
|
973
|
+
},
|
|
974
|
+
} );
|
|
975
|
+
} else if ( inputData?.permissionType === 'review' ) {
|
|
976
|
+
searchQuery.query.bool.must.push( {
|
|
977
|
+
nested: {
|
|
978
|
+
path: 'mappingInfo',
|
|
979
|
+
query: {
|
|
980
|
+
bool: {
|
|
981
|
+
must: [
|
|
982
|
+
{
|
|
983
|
+
term: {
|
|
984
|
+
'mappingInfo.type': 'review',
|
|
985
|
+
},
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
term: {
|
|
989
|
+
'mappingInfo.status': inputData.status[0],
|
|
990
|
+
},
|
|
991
|
+
},
|
|
992
|
+
],
|
|
993
|
+
},
|
|
994
|
+
},
|
|
995
|
+
},
|
|
996
|
+
} );
|
|
997
|
+
} else if ( ticketsFeature ) {
|
|
998
|
+
searchQuery.query.bool.must.push( {
|
|
999
|
+
nested: {
|
|
1000
|
+
path: 'mappingInfo',
|
|
1001
|
+
query: {
|
|
1002
|
+
bool: {
|
|
1003
|
+
must: [
|
|
1004
|
+
{
|
|
1005
|
+
term: {
|
|
1006
|
+
'mappingInfo.type': 'review',
|
|
1007
|
+
},
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
term: {
|
|
1011
|
+
'mappingInfo.status': inputData.status[0],
|
|
1012
|
+
},
|
|
1013
|
+
},
|
|
1014
|
+
],
|
|
1015
|
+
},
|
|
1016
|
+
},
|
|
1017
|
+
},
|
|
1018
|
+
} );
|
|
1019
|
+
} else if ( ticketsApproveFeature ) {
|
|
1020
|
+
searchQuery.query.bool.must.push( {
|
|
1021
|
+
nested: {
|
|
1022
|
+
path: 'mappingInfo',
|
|
1023
|
+
query: {
|
|
1024
|
+
bool: {
|
|
1025
|
+
must: [
|
|
1026
|
+
{
|
|
1027
|
+
term: {
|
|
1028
|
+
'mappingInfo.type': 'approve',
|
|
1029
|
+
},
|
|
1030
|
+
},
|
|
1031
|
+
{
|
|
1032
|
+
term: {
|
|
1033
|
+
'mappingInfo.status': inputData.status[0],
|
|
1034
|
+
},
|
|
1035
|
+
},
|
|
1036
|
+
],
|
|
1037
|
+
},
|
|
1038
|
+
},
|
|
1039
|
+
},
|
|
1040
|
+
} );
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
937
1043
|
|
|
938
1044
|
if ( req?.user?.userType == 'tango' && inputData.tangoType !== 'internal' ) {
|
|
939
1045
|
searchQuery.query.bool.must.push( {
|
|
@@ -1075,7 +1181,7 @@ export async function ticketList( req, res ) {
|
|
|
1075
1181
|
reviewerRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
|
|
1076
1182
|
approverRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'approve' )?.revicedPerc || '--',
|
|
1077
1183
|
tangoRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '--',
|
|
1078
|
-
status: item?.status,
|
|
1184
|
+
status: item?.mappingInfo?.find( ( f ) => f.type === 'approve' )?.status || '--',
|
|
1079
1185
|
tangoStatus: item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '--',
|
|
1080
1186
|
approvedBy: item?.mappingInfo?.find( ( f ) => f.type === 'approve' )?.createdByEmail || '--',
|
|
1081
1187
|
|
|
@@ -1383,90 +1489,89 @@ export async function getTickets( req, res ) {
|
|
|
1383
1489
|
// If mappingInfo is an array, update revisedDetail for each mappingInfo object
|
|
1384
1490
|
if ( Array.isArray( item._source.mappingInfo ) ) {
|
|
1385
1491
|
item._source.mappingInfo.forEach( ( mappingObj ) => {
|
|
1386
|
-
|
|
1387
|
-
commentsResponse = commentsRes?.body?.hits?.hits?.map( ( hit ) => hit._source ) || [];
|
|
1492
|
+
commentsResponse = commentsRes?.body?.hits?.hits?.map( ( hit ) => hit._source ) || [];
|
|
1388
1493
|
|
|
1389
|
-
|
|
1494
|
+
// Check if duplicate condition exists in commentsResponse
|
|
1390
1495
|
|
|
1391
|
-
|
|
1392
|
-
|
|
1496
|
+
// Structure comments output
|
|
1497
|
+
let commentsDetails = [];
|
|
1393
1498
|
|
|
1394
1499
|
|
|
1395
|
-
|
|
1500
|
+
const types = [ 'tagging', 'review', 'approve' ];
|
|
1396
1501
|
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1502
|
+
// Process each type
|
|
1503
|
+
types.forEach( ( typeValue ) => {
|
|
1504
|
+
if ( typeValue === 'tagging' ) {
|
|
1505
|
+
// For tagging, group by category and create separate objects for each category
|
|
1506
|
+
const taggingComments = commentsResponse.filter( ( c ) => c.type === typeValue );
|
|
1402
1507
|
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1508
|
+
// Group by category
|
|
1509
|
+
const categoryGroups = {};
|
|
1510
|
+
taggingComments.forEach( ( c ) => {
|
|
1511
|
+
const category = c.category || 'other';
|
|
1512
|
+
if ( !categoryGroups[category] ) {
|
|
1513
|
+
categoryGroups[category] = [];
|
|
1514
|
+
}
|
|
1515
|
+
categoryGroups[category].push( c );
|
|
1516
|
+
} );
|
|
1517
|
+
|
|
1518
|
+
// Create separate objects for each category
|
|
1519
|
+
Object.keys( categoryGroups ).forEach( ( category ) => {
|
|
1520
|
+
const categoryComments = categoryGroups[category];
|
|
1521
|
+
let parent = null;
|
|
1522
|
+
|
|
1523
|
+
const comms = categoryComments.map( ( c ) => {
|
|
1524
|
+
if ( category === 'duplicate' ) {
|
|
1525
|
+
if ( !parent && c.parent ) {
|
|
1526
|
+
parent = c.parent;
|
|
1527
|
+
}
|
|
1528
|
+
return {
|
|
1529
|
+
createdByEmail: c.createdByEmail,
|
|
1530
|
+
createdByUserName: c.createdByUserName,
|
|
1531
|
+
createdByRole: c.createdByRole,
|
|
1532
|
+
message: c.message,
|
|
1533
|
+
};
|
|
1534
|
+
} else {
|
|
1535
|
+
return {
|
|
1536
|
+
id: c.id,
|
|
1537
|
+
tempId: c.tempId,
|
|
1538
|
+
timeRange: c.timeRange,
|
|
1539
|
+
entryTime: c.entryTime,
|
|
1540
|
+
exitTime: c.exitTime,
|
|
1541
|
+
filePath: c.filePath,
|
|
1542
|
+
isChecked: c.isChecked,
|
|
1543
|
+
createdAt: c.createdAt,
|
|
1544
|
+
message: c.message,
|
|
1545
|
+
createdByEmail: c.createdByEmail,
|
|
1546
|
+
createdByUserName: c.createdByUserName,
|
|
1547
|
+
createdByRole: c.createdByRole,
|
|
1548
|
+
};
|
|
1409
1549
|
}
|
|
1410
|
-
categoryGroups[category].push( c );
|
|
1411
1550
|
} );
|
|
1412
1551
|
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1552
|
+
const taggingObj = {
|
|
1553
|
+
category: category,
|
|
1554
|
+
type: typeValue,
|
|
1555
|
+
comments: comms,
|
|
1556
|
+
};
|
|
1417
1557
|
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
}
|
|
1423
|
-
return {
|
|
1424
|
-
createdByEmail: c.createdByEmail,
|
|
1425
|
-
createdByUserName: c.createdByUserName,
|
|
1426
|
-
createdByRole: c.createdByRole,
|
|
1427
|
-
message: c.message,
|
|
1428
|
-
};
|
|
1429
|
-
} else {
|
|
1430
|
-
return {
|
|
1431
|
-
id: c.id,
|
|
1432
|
-
tempId: c.tempId,
|
|
1433
|
-
timeRange: c.timeRange,
|
|
1434
|
-
entryTime: c.entryTime,
|
|
1435
|
-
exitTime: c.exitTime,
|
|
1436
|
-
filePath: c.filePath,
|
|
1437
|
-
isChecked: c.isChecked,
|
|
1438
|
-
createdAt: c.createdAt,
|
|
1439
|
-
message: c.message,
|
|
1440
|
-
createdByEmail: c.createdByEmail,
|
|
1441
|
-
createdByUserName: c.createdByUserName,
|
|
1442
|
-
createdByRole: c.createdByRole,
|
|
1443
|
-
};
|
|
1444
|
-
}
|
|
1445
|
-
} );
|
|
1446
|
-
|
|
1447
|
-
const taggingObj = {
|
|
1448
|
-
category: category,
|
|
1449
|
-
type: typeValue,
|
|
1450
|
-
comments: comms,
|
|
1451
|
-
};
|
|
1452
|
-
|
|
1453
|
-
// Add parent only for duplicate category
|
|
1454
|
-
if ( category === 'duplicate' && parent !== null ) {
|
|
1455
|
-
taggingObj.parent = parent;
|
|
1456
|
-
}
|
|
1558
|
+
// Add parent only for duplicate category
|
|
1559
|
+
if ( category === 'duplicate' && parent !== null ) {
|
|
1560
|
+
taggingObj.parent = parent;
|
|
1561
|
+
}
|
|
1457
1562
|
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1563
|
+
commentsDetails.push( taggingObj );
|
|
1564
|
+
} );
|
|
1565
|
+
} else if ( typeValue === 'review' || typeValue === 'approve' ) {
|
|
1566
|
+
// For review and approve, keep existing structure
|
|
1567
|
+
const comms = commentsResponse
|
|
1568
|
+
.filter( ( c ) => c.type === typeValue )
|
|
1569
|
+
.map( ( c ) => {
|
|
1570
|
+
if ( c.category === 'duplicate' ) {
|
|
1571
|
+
return {
|
|
1572
|
+
parent: c?.taggedImages[0]?._source?.parent,
|
|
1573
|
+
category: c.category,
|
|
1574
|
+
taggedImages: Array.isArray( c.taggedImages ) ?
|
|
1470
1575
|
c.taggedImages.map( ( img ) => ( {
|
|
1471
1576
|
id: img?._source?.id,
|
|
1472
1577
|
tempId: img?._source?.tempId,
|
|
@@ -1477,16 +1582,16 @@ export async function getTickets( req, res ) {
|
|
|
1477
1582
|
isChecked: img?._source?.isChecked,
|
|
1478
1583
|
} ) ) :
|
|
1479
1584
|
[],
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1585
|
+
createdByEmail: c.createdByEmail,
|
|
1586
|
+
createdByUserName: c.createdByUserName,
|
|
1587
|
+
createdByRole: c.createdByRole,
|
|
1588
|
+
status: c.status,
|
|
1589
|
+
message: c.message,
|
|
1590
|
+
};
|
|
1591
|
+
} else {
|
|
1592
|
+
return {
|
|
1593
|
+
category: c.category,
|
|
1594
|
+
taggedImages: Array.isArray( c.taggedImages ) ?
|
|
1490
1595
|
c.taggedImages.map( ( img ) => ( {
|
|
1491
1596
|
id: img?._source?.id,
|
|
1492
1597
|
tempId: img?._source?.tempId,
|
|
@@ -1497,34 +1602,34 @@ export async function getTickets( req, res ) {
|
|
|
1497
1602
|
isChecked: img?._source?.isChecked,
|
|
1498
1603
|
} ) ) :
|
|
1499
1604
|
[],
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
} );
|
|
1508
|
-
|
|
1509
|
-
// Only add if there are comments
|
|
1510
|
-
if ( comms.length > 0 ) {
|
|
1511
|
-
commentsDetails.push( {
|
|
1512
|
-
type: typeValue,
|
|
1513
|
-
comments: comms,
|
|
1514
|
-
} );
|
|
1515
|
-
} else {
|
|
1516
|
-
// Add empty comments array if no comments
|
|
1517
|
-
commentsDetails.push( {
|
|
1518
|
-
type: typeValue,
|
|
1519
|
-
comments: [],
|
|
1605
|
+
createdByEmail: c.createdByEmail,
|
|
1606
|
+
createdByUserName: c.createdByUserName,
|
|
1607
|
+
createdByRole: c.createdByRole,
|
|
1608
|
+
status: c.status,
|
|
1609
|
+
message: c.message,
|
|
1610
|
+
};
|
|
1611
|
+
}
|
|
1520
1612
|
} );
|
|
1521
|
-
|
|
1613
|
+
|
|
1614
|
+
// Only add if there are comments
|
|
1615
|
+
if ( comms.length > 0 ) {
|
|
1616
|
+
commentsDetails.push( {
|
|
1617
|
+
type: typeValue,
|
|
1618
|
+
comments: comms,
|
|
1619
|
+
} );
|
|
1620
|
+
} else {
|
|
1621
|
+
// Add empty comments array if no comments
|
|
1622
|
+
commentsDetails.push( {
|
|
1623
|
+
type: typeValue,
|
|
1624
|
+
comments: [],
|
|
1625
|
+
} );
|
|
1522
1626
|
}
|
|
1523
|
-
}
|
|
1627
|
+
}
|
|
1628
|
+
} );
|
|
1524
1629
|
|
|
1525
1630
|
|
|
1526
|
-
|
|
1527
|
-
|
|
1631
|
+
item._source.commentsDetails = commentsDetails;
|
|
1632
|
+
|
|
1528
1633
|
if (
|
|
1529
1634
|
Object.prototype.hasOwnProperty.call( mappingObj, 'revisedDetail' ) &&
|
|
1530
1635
|
mappingObj.type !== 'tangoreview'
|
|
@@ -143,7 +143,7 @@ export const ticketListSchema = Joi.object().keys( {
|
|
|
143
143
|
offset: Joi.number().optional(),
|
|
144
144
|
isExport: Joi.boolean().optional(),
|
|
145
145
|
sortBy: Joi.string().optional().allow( '' ),
|
|
146
|
-
status: Joi.
|
|
146
|
+
status: Joi.string().optional(),
|
|
147
147
|
sortOrder: Joi.number().valid( -1, 1 ).optional(),
|
|
148
148
|
tangoType: Joi.string().valid( 'store', 'internal', '' ).optional(),
|
|
149
149
|
permissionType: Joi.string().valid( 'review', 'approve' ).optional(),
|
|
@@ -513,12 +513,13 @@ export async function ticketCreation( req, res, next ) {
|
|
|
513
513
|
count: tempAcc,
|
|
514
514
|
revisedDetail: formattedTaggingData,
|
|
515
515
|
status: 'Open',
|
|
516
|
+
|
|
516
517
|
};
|
|
517
518
|
} else if ( r.actionType === 'approver' && r.isChecked === true ) {
|
|
518
519
|
approverMapping = {
|
|
519
520
|
type: 'approve',
|
|
520
|
-
revicedFootfall: revisedFootfall,
|
|
521
|
-
revicedPerc: Math.round( ( revisedFootfall / footfallCount ) * 100 || 0 ) + '%',
|
|
521
|
+
// revicedFootfall: revisedFootfall,
|
|
522
|
+
// revicedPerc: Math.round( ( revisedFootfall / footfallCount ) * 100 || 0 ) + '%',
|
|
522
523
|
count: tempAcc,
|
|
523
524
|
revisedDetail: formattedTaggingData,
|
|
524
525
|
status: 'Open',
|
|
@@ -601,7 +602,6 @@ export async function ticketCreation( req, res, next ) {
|
|
|
601
602
|
if ( !ticketsFeature ) return;
|
|
602
603
|
|
|
603
604
|
const notifyUser = await getAssinedStore( userData, req.body.storeId );
|
|
604
|
-
|
|
605
605
|
if ( !notifyUser || !userData?.fcmToken ) return;
|
|
606
606
|
|
|
607
607
|
await sendPushNotification( title, description, userData.fcmToken, Data );
|
|
@@ -1083,9 +1083,9 @@ export async function ticketReview( req, res, next ) {
|
|
|
1083
1083
|
revicedFootfall: revisedFootfall,
|
|
1084
1084
|
revicedPerc: Math.round( ( revisedFootfall / footfallCount ) * 100 || 0 ) + '%',
|
|
1085
1085
|
mappingInfo: ticketData?.[0]?._source?.mappingInfo,
|
|
1086
|
-
createdByEmail: req?.user?.email,
|
|
1087
|
-
createdByUserName: req?.user?.userName,
|
|
1088
|
-
createdByRole: req?.user?.role,
|
|
1086
|
+
// createdByEmail: req?.user?.email,
|
|
1087
|
+
// createdByUserName: req?.user?.userName,
|
|
1088
|
+
// createdByRole: req?.user?.role,
|
|
1089
1089
|
|
|
1090
1090
|
};
|
|
1091
1091
|
|
|
@@ -1163,14 +1163,14 @@ export async function ticketReview( req, res, next ) {
|
|
|
1163
1163
|
.map( ( item ) => ( {
|
|
1164
1164
|
...item,
|
|
1165
1165
|
mode: inputData.mode,
|
|
1166
|
-
revicedFootfall: revisedFootfall,
|
|
1167
|
-
revicedPerc: Math.round( ( revisedFootfall / footfallCount ) * 100 || 0 ) + '%',
|
|
1168
|
-
count: tempAcc,
|
|
1169
|
-
revisedDetail: formattedTaggingData,
|
|
1166
|
+
// revicedFootfall: revisedFootfall,
|
|
1167
|
+
// revicedPerc: Math.round( ( revisedFootfall / footfallCount ) * 100 || 0 ) + '%',
|
|
1168
|
+
// count: tempAcc,
|
|
1169
|
+
// revisedDetail: formattedTaggingData,
|
|
1170
1170
|
status: 'Closed',
|
|
1171
|
-
createdByEmail: req?.user?.email,
|
|
1172
|
-
createdByUserName: req?.user?.userName,
|
|
1173
|
-
createdByRole: req?.user?.role,
|
|
1171
|
+
// createdByEmail: req?.user?.email,
|
|
1172
|
+
// createdByUserName: req?.user?.userName,
|
|
1173
|
+
// createdByRole: req?.user?.role,
|
|
1174
1174
|
} ) );
|
|
1175
1175
|
record.mappingInfo = [ ...temp2, ...temp ];
|
|
1176
1176
|
// If no review mapping existed, push a new one
|
|
@@ -1534,9 +1534,9 @@ export async function ticketApprove( req, res, next ) {
|
|
|
1534
1534
|
revicedFootfall: revisedFootfall,
|
|
1535
1535
|
revicedPerc: Math.round( ( revisedFootfall / footfallCount ) * 100 || 0 ) + '%',
|
|
1536
1536
|
mappingInfo: ticketData?.[0]?._source?.mappingInfo,
|
|
1537
|
-
createdByEmail: req?.user?.email,
|
|
1538
|
-
createdByUserName: req?.user?.userName,
|
|
1539
|
-
createdByRole: req?.user?.role,
|
|
1537
|
+
// createdByEmail: req?.user?.email,
|
|
1538
|
+
// createdByUserName: req?.user?.userName,
|
|
1539
|
+
// createdByRole: req?.user?.role,
|
|
1540
1540
|
|
|
1541
1541
|
};
|
|
1542
1542
|
|