tango-app-api-analysis-traffic 3.0.0-alpha.37 → 3.0.0-alpha.38

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.37",
3
+ "version": "3.0.0-alpha.38",
4
4
  "description": "Traffic Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -823,13 +823,13 @@ export async function headerClustersV2( req, res ) {
823
823
  }
824
824
  } else {
825
825
  if ( getUserType == 'tango' ) {
826
- clusterNames = await getclusterList( requestData.clientId, req );
826
+ clusterNames = await getclusterList( requestData.clientId, getUserType, getRole, req );
827
827
  console.log( clusterNames );
828
828
  } else if ( getUserType == 'client' ) {
829
829
  if ( getRole == 'superadmin' ) {
830
- clusterNames = await getclusterList( requestData.clientId, req );
830
+ clusterNames = await getclusterList( requestData.clientId, getUserType, getRole, req );
831
831
  } else {
832
- clusterNames = await getclusterList( requestData.clientId, req );
832
+ clusterNames = await getclusterList( requestData.clientId, getUserType, getRole, req );
833
833
  }
834
834
  }
835
835
  }
@@ -916,6 +916,7 @@ async function getClusterStoresIds( userClientId, storeIds, getRole, getUserType
916
916
  }
917
917
  }
918
918
  } else if ( getUserType == 'tango' ) {
919
+ console.log( storeIds );
919
920
  clusterQuery = [
920
921
  {
921
922
  $match: {
@@ -1526,7 +1527,7 @@ async function getLocationStores( userClientId, cityList, req ) {
1526
1527
  return false;
1527
1528
  }
1528
1529
  }
1529
- async function getclusterList( userClientId, req ) {
1530
+ async function getclusterList( userClientId, getUserType, req ) {
1530
1531
  try {
1531
1532
  if ( userClientId && userClientId !='' ) {
1532
1533
  let filter = [
@@ -1536,7 +1537,10 @@ async function getclusterList( userClientId, req ) {
1536
1537
  filter.push( { 'stores.storeId': { $in: req.body.assignedStores } } );
1537
1538
  }
1538
1539
  console.log( req.user.email );
1539
- filter.push( { 'Teamlead.email': req.user.email } );
1540
+ if ( getUserType == 'client'&&getRole!='superadmin' ) {
1541
+ filter.push( { 'Teamlead.email': req.user.email } );
1542
+ }
1543
+
1540
1544
 
1541
1545
  let clusterQuery = [
1542
1546
  {