tango-app-api-infra 3.1.34-beta.32 → 3.1.34-beta.34

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-infra",
3
- "version": "3.1.34-beta.32",
3
+ "version": "3.1.34-beta.34",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -27,7 +27,7 @@
27
27
  "nodemon": "^3.1.0",
28
28
  "swagger-ui-express": "^5.0.0",
29
29
  "tango-api-schema": "^2.1.30",
30
- "tango-app-api-middleware": "^3.1.43-alpha.7",
30
+ "tango-app-api-middleware": "^3.1.43-alpha.8",
31
31
  "winston": "^3.12.0",
32
32
  "winston-daily-rotate-file": "^5.0.0"
33
33
  },
@@ -13,7 +13,8 @@ export async function infraCard( req, res ) {
13
13
  try {
14
14
  let date = await getUTC( new Date( req.body.fromDate ), new Date( req.body.toDate ) );
15
15
  let storecountQuery ={ 'clientId': { $in: req.body.clientId }, 'createdAt': { $lte: date.end }, 'status': 'active' };
16
- if ( req.user&&req.user.userType ==='client' ) {
16
+ console.log( req.user.role );
17
+ if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
17
18
  storecountQuery = { ...storecountQuery, ...{ storeId: { $in: req.body.assignedStores } } };
18
19
  }
19
20
  let storeCount = await countDocumentsStore( storecountQuery );
@@ -30,7 +31,7 @@ export async function infraCard( req, res ) {
30
31
  },
31
32
  ];
32
33
 
33
- if ( req.user&&req.user.userType ==='client' ) {
34
+ if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
34
35
  yetToInstallQuery.push(
35
36
  {
36
37
  $match: {
@@ -50,7 +51,7 @@ export async function infraCard( req, res ) {
50
51
  ],
51
52
  },
52
53
  } ];
53
- if ( req.user&&req.user.userType ==='client' ) {
54
+ if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
54
55
  totalStoreQuery.push(
55
56
  {
56
57
  $match: {
@@ -227,14 +228,13 @@ export async function installationCard( req, res ) {
227
228
  clientId: { $in: req.body.clientId },
228
229
  createdAt: { $lte: date.end },
229
230
  };
230
- console.log( req.body.assignedStores );
231
- console.log( req.storeIds );
232
- console.log( '-->', req.body.assignedStores );
233
231
 
234
232
 
235
- if ( req.user&&req.user.userType ==='client' ) {
236
- console.log( req.body.assignedStores );
237
- baseQuery = { ...baseQuery, ...{ storeId: { $in: req.body.assignedStores } } };
233
+ if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
234
+ if ( req.body.assignedStores&&req.body.assignedStores.length>0 ) {
235
+ console.log( '=====>', req.body.assignedStores );
236
+ baseQuery = { ...baseQuery, ...{ storeId: { $in: req.body.assignedStores } } };
237
+ }
238
238
  }
239
239
  let onboardQuery = { ...baseQuery };
240
240
  let installedQuery = { ...baseQuery, status: 'active' };
@@ -257,7 +257,7 @@ export async function installationCard( req, res ) {
257
257
  },
258
258
  },
259
259
  ];
260
- if ( req.user&&req.user.userType ==='client' ) {
260
+ if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
261
261
  ticketbaseQuery.push(
262
262
  {
263
263
  $match: {
@@ -374,7 +374,7 @@ export async function infraIssuesTable( req, res ) {
374
374
  ],
375
375
  },
376
376
  } ];
377
- if ( req.user&&req.user.userType ==='client' ) {
377
+ if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
378
378
  totalStoreQuery.push(
379
379
  {
380
380
  $match: {
@@ -399,7 +399,7 @@ export async function infraIssuesTable( req, res ) {
399
399
  ],
400
400
  },
401
401
  } );
402
- if ( req.user&&req.user.userType ==='client' ) {
402
+ if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
403
403
  pendingquery.push(
404
404
  {
405
405
  $match: {
@@ -545,7 +545,7 @@ export async function infraIssuesTable( req, res ) {
545
545
  } ];
546
546
  }
547
547
  }
548
- if ( req.user&&req.user.userType ==='client' ) {
548
+ if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
549
549
  storesQuery.push(
550
550
  {
551
551
  $match: {
@@ -713,7 +713,7 @@ export async function InstallationIssuesTable( req, res ) {
713
713
  ],
714
714
  },
715
715
  } );
716
- if ( req.user&&req.user.userType ==='client' ) {
716
+ if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
717
717
  query.push(
718
718
  {
719
719
  $match: {
@@ -781,7 +781,7 @@ export async function InstallationIssuesTable( req, res ) {
781
781
  },
782
782
  );
783
783
  let storesQuery = [];
784
- if ( req.user&&req.user.userType ==='client' ) {
784
+ if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
785
785
  storesQuery.push(
786
786
  {
787
787
  $match: {
@@ -1143,7 +1143,7 @@ export async function hourWiseDownstores( req, res ) {
1143
1143
  ],
1144
1144
  },
1145
1145
  } ];
1146
- if ( req.user&&req.user.userType ==='client' ) {
1146
+ if ( req.user&&req.user.userType ==='client' &&req.user.role!='superadmin' ) {
1147
1147
  totalStoreQuery.push(
1148
1148
  {
1149
1149
  $match: {
@@ -1168,7 +1168,7 @@ export async function hourWiseDownstores( req, res ) {
1168
1168
  ],
1169
1169
  },
1170
1170
  } );
1171
- if ( req.user&&req.user.userType ==='client' ) {
1171
+ if ( req.user&&req.user.userType ==='client' &&req.user.role!='superadmin' ) {
1172
1172
  pendingquery.push(
1173
1173
  {
1174
1174
  $match: {
@@ -1522,7 +1522,7 @@ export async function ticketCountSplit( req, res ) {
1522
1522
  { issueType: { $in: [ 'highcount', 'lowcount' ] } },
1523
1523
 
1524
1524
  ];
1525
- if ( req.user&&req.user.userType ==='client' ) {
1525
+ if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
1526
1526
  filter.push( { 'basicDetails.storeId': { $in: req.body.assignedStores } } );
1527
1527
  }
1528
1528
  if ( req.user.userType === 'client' ) {
@@ -1701,7 +1701,7 @@ export async function ticketCount( req, res ) {
1701
1701
  },
1702
1702
 
1703
1703
  ];
1704
- if ( req.user&&req.user.userType ==='client' ) {
1704
+ if ( req.user&&req.user.userType ==='client' &&req.user.role!='superadmin' ) {
1705
1705
  filter.push( { 'basicDetails.storeId': { $in: req.body.assignedStores } } );
1706
1706
  }
1707
1707
  if ( req.user.userType === 'client' ) {
@@ -1109,7 +1109,7 @@ export async function allCounts( req, res ) {
1109
1109
  let date = await getUTC( new Date( req.body.fromDate ), new Date( req.body.toDate ) );
1110
1110
  let countQuery = [];
1111
1111
 
1112
- if ( req.user&&req.user.userType ==='client' ) {
1112
+ if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
1113
1113
  countQuery.push(
1114
1114
  {
1115
1115
  $match: {
@@ -1203,7 +1203,7 @@ export async function infraTable( req, res ) {
1203
1203
  },
1204
1204
  } );
1205
1205
  }
1206
- if ( req.user&&req.user.userType ==='client' ) {
1206
+ if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
1207
1207
  query.push(
1208
1208
  {
1209
1209
  $match: {
@@ -1538,7 +1538,7 @@ export async function installationTable( req, res ) {
1538
1538
  },
1539
1539
  } );
1540
1540
  }
1541
- if ( req.user&&req.user.userType ==='client' ) {
1541
+ if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
1542
1542
  query.push(
1543
1543
  {
1544
1544
  $match: {
@@ -2014,9 +2014,7 @@ export async function storeFilter( req, res ) {
2014
2014
  'issueType': { '$in': [ 'highcount', 'lowcount' ] }, 'basicDetails.clientId': inputData.clientId, 'basicDetails.storeId': { $exists: true },
2015
2015
  };
2016
2016
  }
2017
- if ( req.user&&req.user.userType ==='client' ) {
2018
- console.log( '---->', req.body.assignedStores );
2019
-
2017
+ if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
2020
2018
  query = { ...query, 'basicDetails.storeId': { $in: req.body.assignedStores } };
2021
2019
  }
2022
2020
  console.log( query );
@@ -2054,7 +2052,7 @@ export async function dataMismatchTable( req, res ) {
2054
2052
  },
2055
2053
 
2056
2054
  ];
2057
- if ( req.user&&req.user.userType ==='client' ) {
2055
+ if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
2058
2056
  countFilter.push(
2059
2057
  { 'basicDetails.storeId': { $in: req.body.assignedStores } },
2060
2058
  );
@@ -2124,7 +2122,7 @@ export async function dataMismatchTable( req, res ) {
2124
2122
  { 'basicDetails.clientId': { $in: inputData.clientId } },
2125
2123
  { issueType: { $in: [ 'highcount', 'lowcount' ] } },
2126
2124
  ];
2127
- if ( req.user&&req.user.userType ==='client' ) {
2125
+ if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
2128
2126
  filter.push(
2129
2127
  { 'basicDetails.storeId': { $in: req.body.assignedStores } },
2130
2128
  );