tango-app-api-infra 3.9.5-vms.67 → 3.9.5-vms.69

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.5-vms.67",
3
+ "version": "3.9.5-vms.69",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -182,11 +182,25 @@ export async function tangoReviewTicket( req, res ) {
182
182
  },
183
183
  };
184
184
  if ( Ticket[0]?._source?.type != 'internal' ) {
185
- getTicket.query.bool.must.push( {
186
- term: {
187
- 'mappingInfo.type': 'tangoreview',
188
- },
189
- } );
185
+ getTicket.query.bool.must.push(
186
+ {
187
+ nested: {
188
+ path: 'mappingInfo',
189
+ query: {
190
+ bool: {
191
+ must: [
192
+ {
193
+ term: {
194
+ 'mappingInfo.type': 'tangoreview',
195
+ },
196
+ },
197
+
198
+ ],
199
+ },
200
+ },
201
+ },
202
+ },
203
+ );
190
204
  }
191
205
  const getFootfallticketData = await getOpenSearchData( openSearch.footfallDirectory, getTicket );
192
206
  const ticketData = getFootfallticketData?.body?.hits?.hits;
@@ -394,9 +408,7 @@ export async function tangoReviewTicket( req, res ) {
394
408
 
395
409
  if ( Ticket[0]?._source?.type==='store' ) {
396
410
  let findTagging = Ticket[0]?._source?.mappingInfo.filter( ( data ) => data.type==='tagging' );
397
- console.log( '🚀 ~ tangoReviewTicket ~ findTgging:', findTagging[0] );
398
411
  if ( findTagging?.length>0&&findTagging[0].createdByEmail!='' ) {
399
- console.log( '🚀 ~ tangoReviewTicket ~ findTgging.mappingInfo[0]?.createdByEmail:', findTagging[0]?.createdByEmail );
400
412
  let userData = await findOneUser( { email: findTagging[0]?.createdByEmail } );
401
413
  let title = `Received response for the Footfall ticket raised.`;
402
414
  let createdOn = dayjs( Ticket[0]?._source?.dateString ).format( 'DD MMM YYYY' );
@@ -940,7 +952,7 @@ export async function ticketList( req, res ) {
940
952
  },
941
953
  } );
942
954
  }
943
- if ( inputData.status ) {
955
+ if ( inputData.status && inputData.status!=='' ) {
944
956
  inputData.status = inputData?.status?.split( ',' );
945
957
  if ( req.user.userType === 'tango' ) {
946
958
  searchQuery.query.bool.must.push( {
@@ -1042,40 +1054,83 @@ export async function ticketList( req, res ) {
1042
1054
  }
1043
1055
 
1044
1056
  if ( req?.user?.userType == 'tango' && inputData.tangoType !== 'internal' ) {
1045
- searchQuery.query.bool.must.push( {
1046
- term: {
1047
- 'mappingInfo.type': 'tangoreview',
1048
- },
1049
- },
1050
- {
1051
- term: {
1052
- 'type.keyword': 'store',
1053
- },
1054
- },
1057
+ searchQuery.query.bool.must.push(
1058
+ {
1059
+ term: {
1060
+ 'type.keyword': 'store',
1061
+ },
1062
+ },
1063
+ {
1064
+ nested: {
1065
+ path: 'mappingInfo',
1066
+ query: {
1067
+ bool: {
1068
+ must: [
1069
+ {
1070
+ term: {
1071
+ 'mappingInfo.type': 'tangoreview',
1072
+ },
1073
+ },
1074
+
1075
+ ],
1076
+ },
1077
+ },
1078
+ },
1079
+
1080
+ },
1055
1081
 
1056
1082
 
1057
1083
  );
1058
1084
  } else if ( inputData.tangoType !== 'internal' ) {
1059
- searchQuery.query.bool.must.push( {
1060
- term: {
1061
- 'mappingInfo.type': ticketsFeature ? 'review' : ticketsApproveFeature ?
1062
- 'approve' : 'tagging',
1063
- },
1064
- },
1065
- {
1066
- term: {
1067
- 'type.keyword': 'store',
1068
- },
1069
- } );
1085
+ searchQuery.query.bool.must.push(
1086
+ {
1087
+ term: {
1088
+ 'type.keyword': 'store',
1089
+ },
1090
+ },
1091
+ {
1092
+ nested: {
1093
+ path: 'mappingInfo',
1094
+ query: {
1095
+ bool: {
1096
+ must: [
1097
+ {
1098
+ term: {
1099
+ 'mappingInfo.type': ticketsFeature ? 'review' : ticketsApproveFeature ?
1100
+ 'approve' : 'tagging',
1101
+ },
1102
+ },
1103
+
1104
+ ],
1105
+ },
1106
+ },
1107
+ },
1108
+ },
1109
+
1110
+ );
1070
1111
  }
1071
1112
 
1072
1113
  if ( inputData?.permissionType ) {
1073
- searchQuery.query.bool.must.push( {
1074
- term: {
1075
- 'mappingInfo.type': inputData?.permissionType == 'review' ? 'review' :
1076
- 'approve',
1077
- },
1078
- } );
1114
+ searchQuery.query.bool.must.push(
1115
+ {
1116
+ nested: {
1117
+ path: 'mappingInfo',
1118
+ query: {
1119
+ bool: {
1120
+ must: [
1121
+ {
1122
+ term: {
1123
+ 'mappingInfo.type': inputData?.permissionType == 'review' ? 'review' :
1124
+ 'approve',
1125
+ },
1126
+ },
1127
+
1128
+ ],
1129
+ },
1130
+ },
1131
+ },
1132
+ },
1133
+ );
1079
1134
  }
1080
1135
 
1081
1136
  if ( inputData.searchValue && inputData.searchValue !== '' ) {
@@ -1110,7 +1165,6 @@ export async function ticketList( req, res ) {
1110
1165
  }
1111
1166
  // You can add more filters as needed
1112
1167
  const searchResult = await getOpenSearchData( openSearch.footfallDirectory, searchQuery );
1113
- logger.info( { searchResult } );
1114
1168
  const count = searchResult?.body?.hits?.total?.value || 0;
1115
1169
 
1116
1170
  if ( count === 0 ) {
@@ -2402,7 +2456,6 @@ export async function downloadTickets( req, res ) {
2402
2456
  }
2403
2457
 
2404
2458
  async function extractTempIds( document ) {
2405
- logger.info( { document: document } );
2406
2459
  const source = document?._source || {};
2407
2460
  const result = [];
2408
2461
 
@@ -2522,7 +2575,6 @@ export async function openTicketList( req, res ) {
2522
2575
 
2523
2576
  // Assuming getOpenSearchData and openSearch.footfallDirectoryTagging are available
2524
2577
  const result = await getOpenSearchData( openSearch.footfallDirectory, openSearchQuery );
2525
- logger.info( { result } );
2526
2578
  const getUserlist = result?.body?.hits?.hits?.map( ( hit ) => hit._source ) || [];
2527
2579
  return res.sendSuccess( getUserlist || [] );
2528
2580
  } catch ( error ) {
@@ -2537,8 +2589,7 @@ export async function assignTicket( req, res ) {
2537
2589
  const inputData = req.body;
2538
2590
  const openSearch = JSON.parse( process.env.OPENSEARCH );
2539
2591
 
2540
- const { email, userName, role, actionType, storeId, dateString } = inputData;
2541
- logger.info( { actionType } );
2592
+ const { email, userName, role, storeId, dateString } = inputData;
2542
2593
  const _id = `${storeId}_${dateString}_footfall-directory-tagging`;
2543
2594
 
2544
2595
  const getTicket = await getOpenSearchById( openSearch.footfallDirectory, _id );