tango-app-api-analysis-traffic 3.0.0-alpha.59 → 3.0.0-alpha.60

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-analysis-traffic",
3
- "version": "3.0.0-alpha.59",
3
+ "version": "3.0.0-alpha.60",
4
4
  "description": "Traffic Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -86,6 +86,7 @@ export async function addBills( req, res ) {
86
86
  export async function getNobData( req, res ) {
87
87
  try {
88
88
  const inputData = req.body;
89
+ let isEdit = false;
89
90
  if ( req.user.role !== 'superadmin' && req.user.userType !== 'tango' && ( req?.body?.assignedStores?.length == 0 || !req?.body?.assignedStores ) ) {
90
91
  return res.sendError( 'No data found', 204 );
91
92
  }
@@ -124,21 +125,21 @@ export async function getNobData( req, res ) {
124
125
  {
125
126
  'wildcard': {
126
127
  'storeId.keyword': {
127
- 'value': `${searchValue}*`,
128
+ 'value': `*${searchValue}*`,
128
129
  },
129
130
  },
130
131
  },
131
132
  {
132
133
  'wildcard': {
133
134
  'storeCode.keyword': {
134
- 'value': `${searchValue}*`,
135
+ 'value': `*${searchValue}*`,
135
136
  },
136
137
  },
137
138
  },
138
139
  {
139
140
  'wildcard': {
140
141
  'storeName.keyword': {
141
- 'value': `${searchValue.toLowerCase()}*`,
142
+ 'value': `*${searchValue.toLowerCase()}*`,
142
143
  },
143
144
  },
144
145
  },
@@ -196,6 +197,8 @@ export async function getNobData( req, res ) {
196
197
  let temp=[];
197
198
 
198
199
  data._source.isUpdated = data._source.createdAt !== data._source.updatedAt? true : false;
200
+ !data._source.isUpdated ? isEdit = true: null;
201
+
199
202
  footfall.map( ( item ) => {
200
203
  if ( ( data._source.dateString === item._source.date_string ) && ( data._source.storeId === item._source.store_id ) ) {
201
204
  count = 1;
@@ -286,7 +289,7 @@ export async function getNobData( req, res ) {
286
289
  return;
287
290
  }
288
291
 
289
- return res.sendSuccess( { result: result, count: getNobData?.body?.hits?.total?.value, convertionCalculation: getClient?.featureConfigs?.conversionCalculation } );
292
+ return res.sendSuccess( { result: result, count: getNobData?.body?.hits?.total?.value, convertionCalculation: getClient?.featureConfigs?.conversionCalculation, isEdit: isEdit } );
290
293
  } catch ( error ) {
291
294
  const err = error.message || 'Internal Server Error';
292
295
  logger.error( { error: error, message: req.body, function: 'nob-getNobData' } );