tango-app-api-infra 3.9.5-vms.65 β†’ 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.65",
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 index.js\""
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
- console.log( 'πŸš€ ~ tangoReviewTicket ~ Ticket:', Ticket );
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
- 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
- }
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
- 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
- }
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 userData = await findOneUser( { email: Ticket[0]?._source?.createdByEmail } );
397
- let title = `Received response for the Footfall ticket raised.`;
398
- let createdOn = dayjs( Ticket[0]?._source?.dateString ).format( 'DD MMM YYYY' );
399
- let description = `Raised on ${createdOn}`;
400
- console.log( 'πŸš€ ~ ticketCreation ~ userData.role:', userData.email );
401
- let Data = {
402
- 'title': title,
403
- 'body': description,
404
- 'type': 'closed',
405
- 'date': Ticket[0]?._source?.dateString,
406
- 'storeId': Ticket[0]?._source?.storeId,
407
- 'clientId': Ticket[0]?._source?.clientId,
408
- 'ticketId': Ticket[0]?._source?.ticketId,
409
- };
410
- if ( userData && userData.fcmToken ) {
411
- const fcmToken = userData.fcmToken;
412
- await sendPushNotification( title, description, fcmToken, Data );
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
- if ( mappingObj.status == 'In-Progress' ) {
1387
- commentsResponse = commentsRes?.body?.hits?.hits?.map( ( hit ) => hit._source ) || [];
1492
+ commentsResponse = commentsRes?.body?.hits?.hits?.map( ( hit ) => hit._source ) || [];
1388
1493
 
1389
- // Check if duplicate condition exists in commentsResponse
1494
+ // Check if duplicate condition exists in commentsResponse
1390
1495
 
1391
- // Structure comments output
1392
- let commentsDetails = [];
1496
+ // Structure comments output
1497
+ let commentsDetails = [];
1393
1498
 
1394
1499
 
1395
- const types = [ 'tagging', 'review', 'approve' ];
1500
+ const types = [ 'tagging', 'review', 'approve' ];
1396
1501
 
1397
- // Process each type
1398
- types.forEach( ( typeValue ) => {
1399
- if ( typeValue === 'tagging' ) {
1400
- // For tagging, group by category and create separate objects for each category
1401
- const taggingComments = commentsResponse.filter( ( c ) => c.type === typeValue );
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
- // Group by category
1404
- const categoryGroups = {};
1405
- taggingComments.forEach( ( c ) => {
1406
- const category = c.category || 'other';
1407
- if ( !categoryGroups[category] ) {
1408
- categoryGroups[category] = [];
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
- // Create separate objects for each category
1414
- Object.keys( categoryGroups ).forEach( ( category ) => {
1415
- const categoryComments = categoryGroups[category];
1416
- let parent = null;
1552
+ const taggingObj = {
1553
+ category: category,
1554
+ type: typeValue,
1555
+ comments: comms,
1556
+ };
1417
1557
 
1418
- const comms = categoryComments.map( ( c ) => {
1419
- if ( category === 'duplicate' ) {
1420
- if ( !parent && c.parent ) {
1421
- parent = c.parent;
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
- commentsDetails.push( taggingObj );
1459
- } );
1460
- } else if ( typeValue === 'review' || typeValue === 'approve' ) {
1461
- // For review and approve, keep existing structure
1462
- const comms = commentsResponse
1463
- .filter( ( c ) => c.type === typeValue )
1464
- .map( ( c ) => {
1465
- if ( c.category === 'duplicate' ) {
1466
- return {
1467
- parent: c?.taggedImages[0]?._source?.parent,
1468
- category: c.category,
1469
- taggedImages: Array.isArray( c.taggedImages ) ?
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
- createdByEmail: c.createdByEmail,
1481
- createdByUserName: c.createdByUserName,
1482
- createdByRole: c.createdByRole,
1483
- status: c.status,
1484
- message: c.message,
1485
- };
1486
- } else {
1487
- return {
1488
- category: c.category,
1489
- taggedImages: Array.isArray( c.taggedImages ) ?
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
- createdByEmail: c.createdByEmail,
1501
- createdByUserName: c.createdByUserName,
1502
- createdByRole: c.createdByRole,
1503
- status: c.status,
1504
- message: c.message,
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
- item._source.commentsDetails = commentsDetails;
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.array().items( Joi.string().required() ).optional(),
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(),
@@ -508,17 +508,18 @@ export async function ticketCreation( req, res, next ) {
508
508
  if ( r.actionType === 'reviewer' && r.isChecked === true ) {
509
509
  revisionMapping = {
510
510
  type: 'review',
511
- revicedFootfall: revisedFootfall,
512
- revicedPerc: Math.round( ( revisedFootfall / footfallCount ) * 100 || 0 ) + '%',
511
+ // revicedFootfall: revisedFootfall,
512
+ // revicedPerc: Math.round( ( revisedFootfall / footfallCount ) * 100 || 0 ) + '%',
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',
@@ -526,8 +527,8 @@ export async function ticketCreation( req, res, next ) {
526
527
  } else if ( r.actionType === 'tango' && r.isChecked === true ) {
527
528
  tangoReviewMapping = {
528
529
  type: 'tangoreview',
529
- revicedFootfall: revisedFootfall,
530
- revicedPerc: Math.round( ( revisedFootfall / footfallCount ) * 100 || 0 ) + '%',
530
+ // revicedFootfall: revisedFootfall,
531
+ // revicedPerc: Math.round( ( revisedFootfall / footfallCount ) * 100 || 0 ) + '%',
531
532
  count: tempAcc,
532
533
  revisedDetail: formattedTaggingData,
533
534
  status: 'Open',
@@ -570,7 +571,7 @@ export async function ticketCreation( req, res, next ) {
570
571
  ];
571
572
 
572
573
  const finduserList = await aggregateUser( userQuery );
573
- console.log( 'πŸš€ ~ ticketCreation ~ finduserList:', finduserList.length );
574
+
574
575
 
575
576
  const createdOn = dayjs().format( 'DD MMM YYYY' );
576
577
  const title = `${getstoreName?.storeName} Have raised a ticket for a Footfall Mismatch`;
@@ -596,12 +597,11 @@ export async function ticketCreation( req, res, next ) {
596
597
  m.name === 'reviewer' && ( m.isAdd === true || m.isEdit === true ),
597
598
  ),
598
599
  );
599
- console.log( 'πŸš€ ~ ticketCreation ~ ticketsFeature:', ticketsFeature );
600
+
600
601
 
601
602
  if ( !ticketsFeature ) return;
602
603
 
603
604
  const notifyUser = await getAssinedStore( userData, req.body.storeId );
604
- console.log( 'πŸš€ ~ ticketCreation ~ notifyUser:', notifyUser );
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
@@ -1223,8 +1223,8 @@ export async function ticketReview( req, res, next ) {
1223
1223
  if ( r.actionType === 'approver' && r.isChecked === true ) {
1224
1224
  approverMapping = {
1225
1225
  type: 'approve',
1226
- revicedFootfall: revisedFootfall,
1227
- revicedPerc: Math.round( ( revisedFootfall / footfallCount ) * 100 || 0 ) + '%',
1226
+ // revicedFootfall: revisedFootfall,
1227
+ // revicedPerc: Math.round( ( revisedFootfall / footfallCount ) * 100 || 0 ) + '%',
1228
1228
  count: tempAcc,
1229
1229
  revisedDetail: formattedTaggingData,
1230
1230
  status: 'Open',
@@ -1232,8 +1232,8 @@ export async function ticketReview( req, res, next ) {
1232
1232
  } else if ( r.actionType === 'tango' && r.isChecked === true ) {
1233
1233
  tangoReviewMapping = {
1234
1234
  type: 'tangoreview',
1235
- revicedFootfall: revisedFootfall,
1236
- revicedPerc: Math.round( ( revisedFootfall / footfallCount ) * 100 || 0 ) + '%',
1235
+ // revicedFootfall: revisedFootfall,
1236
+ // revicedPerc: Math.round( ( revisedFootfall / footfallCount ) * 100 || 0 ) + '%',
1237
1237
  count: tempAcc,
1238
1238
  revisedDetail: formattedTaggingData,
1239
1239
  status: 'Open',
@@ -1269,7 +1269,7 @@ export async function ticketReview( req, res, next ) {
1269
1269
  },
1270
1270
  ];
1271
1271
  let finduserList = await aggregateUser( userQuery );
1272
- console.log( 'πŸš€ ~ ticketReview ~ finduserList:', finduserList.length );
1272
+
1273
1273
 
1274
1274
  // return;
1275
1275
  for ( let userData of finduserList ) {
@@ -1499,7 +1499,7 @@ export async function ticketApprove( req, res, next ) {
1499
1499
  if ( !taggingImages || taggingImages?.length == 0 ) {
1500
1500
  return res.sendError( 'You don’t have any tagged images right now', 400 );
1501
1501
  }
1502
- logger.info( { taggingImages } );
1502
+
1503
1503
  const formattedTaggingData = formatRevopTaggingHits( taggingImages );
1504
1504
 
1505
1505
  const getTicket = {
@@ -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
 
@@ -1647,14 +1647,14 @@ export async function ticketApprove( req, res, next ) {
1647
1647
 
1648
1648
  record.mappingInfo = [ ...ticketData?.[0]?._source?.mappingInfo.slice( 0, -1 ),
1649
1649
  ...temp ];
1650
- if ( Array.isArray( record.mappingInfo ) ) {
1651
- record.mappingInfo = record.mappingInfo.map( ( item ) => {
1652
- return {
1653
- ...item,
1654
- status: 'Closed',
1655
- };
1656
- } );
1657
- }
1650
+ // if ( Array.isArray( record.mappingInfo ) ) {
1651
+ // record.mappingInfo = record.mappingInfo.map( ( item ) => {
1652
+ // return {
1653
+ // ...item,
1654
+ // status: 'Closed',
1655
+ // };
1656
+ // } );
1657
+ // }
1658
1658
  // If no review mapping existed, push a new one
1659
1659
  if ( record.mappingInfo.length === 0 ) {
1660
1660
  record.mappingInfo.push( {
@@ -1678,8 +1678,8 @@ export async function ticketApprove( req, res, next ) {
1678
1678
  // if ( r.actionType === 'tango' && r.isChecked === true ) {
1679
1679
  tangoReviewMapping = {
1680
1680
  type: 'tangoreview',
1681
- revicedFootfall: revisedFootfall,
1682
- revicedPerc: Math.round( ( revisedFootfall / footfallCount ) * 100 || 0 ) + '%',
1681
+ // revicedFootfall: revisedFootfall,
1682
+ // revicedPerc: Math.round( ( revisedFootfall / footfallCount ) * 100 || 0 ) + '%',
1683
1683
  count: tempAcc,
1684
1684
  revisedDetail: formattedTaggingData,
1685
1685
  status: 'Open',
@@ -1769,13 +1769,13 @@ export async function ticketApprove( req, res, next ) {
1769
1769
  },
1770
1770
  ];
1771
1771
  let finduserList = await aggregateUser( userQuery );
1772
- console.log( 'πŸš€ ~ ticketReview ~ finduserList:', finduserList );
1772
+
1773
1773
 
1774
1774
  for ( let userData of finduserList ) {
1775
1775
  let title = `${getstoreName?.storeName} Have raised a ticket for a Footfall Mismatch`;
1776
1776
  let createdOn = dayjs().format( 'DD MMM YYYY' );
1777
1777
  let description = `Created on ${createdOn}`;
1778
- console.log( 'πŸš€ ~ ticketCreation ~ userData.role:', userData.email );
1778
+
1779
1779
  let Data = {
1780
1780
  'title': title,
1781
1781
  'body': description,
@@ -1787,7 +1787,7 @@ export async function ticketApprove( req, res, next ) {
1787
1787
  };
1788
1788
 
1789
1789
  const ticketsFeature = userData?.rolespermission?.some( ( f ) => f.featureName === 'FootfallDirectory' && ( f.modules.find( ( m ) => m.name == 'approver' && ( m.isAdd == true || m.isEdit == true ) ) ) );
1790
- console.log( ticketsFeature );
1790
+
1791
1791
  if ( ticketsFeature ) {
1792
1792
  let notifyuser = await getAssinedStore( userData, req.body.storeId );
1793
1793
  if ( userData && userData.fcmToken && notifyuser ) {
@@ -1801,7 +1801,7 @@ export async function ticketApprove( req, res, next ) {
1801
1801
  const id = `${inputData.storeId}_${inputData.dateString}_footfall-directory-tagging`;
1802
1802
  const insertResult = await updateOpenSearchData( openSearch.footfallDirectory, id, { doc: record } );
1803
1803
 
1804
- logger.info( { insertResult, record, id } );
1804
+
1805
1805
  if ( insertResult && ( insertResult.statusCode === 201 || insertResult.statusCode === 200 ) ) {
1806
1806
  return res.sendSuccess( 'Ticket closed successfully' );
1807
1807
  } else {