tango-app-api-analysis-traffic 3.8.12 → 3.8.13

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.8.12",
3
+ "version": "3.8.13",
4
4
  "description": "Traffic Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -3,7 +3,7 @@ import { aggregateStore } from '../services/stores.service.js';
3
3
  import { findOneNobBilling, updateOneNobBilling } from '../services/nob.service.js';
4
4
  import dayjs from 'dayjs';
5
5
  import { findOne } from '../services/clients.services.js';
6
- import { find } from '../services/tagging.service.js';
6
+ import { find, aggregate } from '../services/tagging.service.js';
7
7
 
8
8
  export async function storeList( req, res ) {
9
9
  try {
@@ -63,8 +63,8 @@ export async function addBills( req, res ) {
63
63
  let resData = [];
64
64
  const openSearch = JSON.parse( process.env.OPENSEARCH );
65
65
  const inputData = req.tempInserData;
66
- console.log( '🚀 ~ addBills ~ inputData:', inputData );
67
-
66
+ console.log( '🚀 ~ addBills ~ inputData:', inputData.length );
67
+ // return;
68
68
  for ( let i = 0; i < inputData?.length; i++ ) {
69
69
  await updateOneNobBilling( inputData[i]?.query, inputData[i]?.data );
70
70
  const getData = await findOneNobBilling( inputData[i]?.query, { _id: 0 } );
@@ -166,6 +166,7 @@ export async function getNobData( req, res ) {
166
166
  };
167
167
 
168
168
  const getNobData = await getOpenSearchData( openSearch.nob, nobQuery );
169
+ console.log( '🚀 ~ getNobData ~ openSearch.nob:', openSearch.nob );
169
170
  const nobData = getNobData?.body?.hits?.hits;
170
171
  if ( !nobData || nobData?.length == 0 ) {
171
172
  if ( inputData.searchValue && inputData.searchValue !== '' || inputData.offset > 1 ) {
@@ -315,7 +316,26 @@ function escapeSpecialChars( str ) {
315
316
 
316
317
  export async function zonelist( req, res ) {
317
318
  try {
318
- let zonelist = await find( { storeId: { $in: req.body.storeId }, productName: 'tangoZone', coordinates: { $ne: [] } }, { tagName: 1 } );
319
+ let zonelist = await aggregate( [
320
+ {
321
+ $match: {
322
+ storeId: { $in: req.body.storeId },
323
+ productName: 'tangoZone',
324
+ coordinates: { $ne: [] },
325
+ },
326
+ },
327
+ {
328
+ $group: {
329
+ _id: '$tagName',
330
+ },
331
+ },
332
+ {
333
+ $project: {
334
+ _id: 0,
335
+ tagName: '$_id',
336
+ },
337
+ },
338
+ ] );
319
339
  return res.sendSuccess( zonelist );
320
340
  } catch ( error ) {
321
341
  const err = error.message || 'Internal Server Error';
@@ -331,6 +351,7 @@ export async function zonetemplate( req, res ) {
331
351
  {
332
352
  $match: {
333
353
  clientId: req.body.clientId,
354
+ status: 'active',
334
355
  },
335
356
  },
336
357
  ],