tango-app-api-analysis-traffic 3.0.0-alpha.56 → 3.0.0-alpha.58
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
|
@@ -99,7 +99,7 @@ export async function getNobData( req, res ) {
|
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
101
|
range: { nobDate: { gte: dateRange.start,
|
|
102
|
-
|
|
102
|
+
lte: dateRange.end } },
|
|
103
103
|
},
|
|
104
104
|
];
|
|
105
105
|
if ( req.user.role !== 'superadmin' && req.user.userType !== 'tango' ) {
|
|
@@ -161,7 +161,7 @@ export async function getNobData( req, res ) {
|
|
|
161
161
|
const getNobData=await getOpenSearchData( openSearch.nob, nobQuery );
|
|
162
162
|
const nobData = getNobData?.body?.hits?.hits;
|
|
163
163
|
if ( !nobData ||nobData?.length == 0 ) {
|
|
164
|
-
if ( inputData.searchValue && inputData.searchValue!== '' ) {
|
|
164
|
+
if ( inputData.searchValue && inputData.searchValue!== '' || inputData.offset> 1 ) {
|
|
165
165
|
return res.sendError( 'No Data Found', 204 );
|
|
166
166
|
} else {
|
|
167
167
|
return res.sendSuccess( { initialInsert: false } );
|
|
@@ -169,9 +169,7 @@ export async function getNobData( req, res ) {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
const footfallQuery={
|
|
172
|
-
'
|
|
173
|
-
'exclude': [ 'storeName' ], // Specify the fields to exclude
|
|
174
|
-
},
|
|
172
|
+
'size': 10000,
|
|
175
173
|
'query': {
|
|
176
174
|
'bool': {
|
|
177
175
|
'must': [
|
|
@@ -191,14 +189,14 @@ export async function getNobData( req, res ) {
|
|
|
191
189
|
|
|
192
190
|
const getFootfall= await getOpenSearchData( openSearch.footfall, footfallQuery );
|
|
193
191
|
const footfall = getFootfall?.body?.hits?.hits;
|
|
194
|
-
logger.info( { footfall:
|
|
192
|
+
logger.info( { footfall: getFootfall, nobData: nobData } );
|
|
195
193
|
let result=[];
|
|
196
|
-
nobData.map( ( data ) => {
|
|
194
|
+
nobData.map( async ( data ) => {
|
|
197
195
|
let count = 0;
|
|
198
196
|
let temp=[];
|
|
199
197
|
|
|
200
198
|
data._source.isUpdated = data._source.createdAt !== data._source.updatedAt? true : false;
|
|
201
|
-
footfall.
|
|
199
|
+
footfall.map( ( item ) => {
|
|
202
200
|
if ( ( data._source.dateString === item._source.date_string ) && ( data._source.storeId === item._source.store_id ) ) {
|
|
203
201
|
count = 1;
|
|
204
202
|
temp =[
|
|
@@ -238,6 +236,8 @@ export async function getNobData( req, res ) {
|
|
|
238
236
|
|
|
239
237
|
} );
|
|
240
238
|
} else {
|
|
239
|
+
// const getStore = await findOneStore( { storeId: data.storeId }, { _id: 0, storeName: 1 } );
|
|
240
|
+
// data._source.storeName = getStore.storeName || data.storeName;
|
|
241
241
|
result.push( {
|
|
242
242
|
|
|
243
243
|
...data._source,
|
|
@@ -276,7 +276,7 @@ export async function getNobData( req, res ) {
|
|
|
276
276
|
default:
|
|
277
277
|
exportData[index]['Engagers Count'] = element.engagersCount;
|
|
278
278
|
}
|
|
279
|
-
element.conversionRate? exportData[index]['Conversion Rate'] = `${element.conversionRate}
|
|
279
|
+
element.conversionRate? exportData[index]['Conversion Rate'] = `${element.conversionRate}` : exportData[index]['Conversion Rate'] =null;
|
|
280
280
|
} );
|
|
281
281
|
return exportData;
|
|
282
282
|
} );
|
package/src/routes/nob.routes.js
CHANGED
|
@@ -9,7 +9,7 @@ const nobRouter=express.Router();
|
|
|
9
9
|
// store list
|
|
10
10
|
nobRouter.get( '/store-list', isAllowedSessionHandler, accessVerification( { userType: [ 'client', 'tango' ] } ), validate( storeListValid ), clientValidations, getAssinedStore, storeList );
|
|
11
11
|
|
|
12
|
-
nobRouter.post( '/add-bills', isAllowedSessionHandler, accessVerification( { userType: [ 'client', 'tango' ] } ), bulkValidate( addBillsValid ), roleVerification, clientValidations,
|
|
12
|
+
nobRouter.post( '/add-bills', isAllowedSessionHandler, accessVerification( { userType: [ 'client', 'tango' ] } ), bulkValidate( addBillsValid ), roleVerification, clientValidations, getAssinedStore, fieldValidation, addBills );
|
|
13
13
|
|
|
14
14
|
nobRouter.post( '/get-nob-data', isAllowedSessionHandler, accessVerification( { userType: [ 'client', 'tango' ] } ), validate( getNobDataValid ), clientValidations, getAssinedStore, getNobData );
|
|
15
15
|
|