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

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