tango-app-api-infra 3.0.112-dev → 3.0.117-dev

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.0.112-dev",
3
+ "version": "3.0.117-dev",
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.0.115",
30
- "tango-app-api-middleware": "^3.1.19",
30
+ "tango-app-api-middleware": "^3.1.26",
31
31
  "winston": "^3.12.0",
32
32
  "winston-daily-rotate-file": "^5.0.0"
33
33
  },
@@ -6,12 +6,18 @@ import { findinfraReason } from '../services/infraReason.service.js';
6
6
  import { aggregateClient, findClient } from '../services/client.service.js';
7
7
  import dayjs from 'dayjs';
8
8
  import { getOpenSearchData } from 'tango-app-api-middleware';
9
+ import { aggregateUserAssignedStore, findUserAssignedStore } from '../services/userAssignedStore.service.js';
10
+
9
11
 
10
12
  export async function infraCard( req, res ) {
11
13
  try {
12
14
  let date = await getUTC( new Date( req.body.fromDate ), new Date( req.body.toDate ) );
13
- let storeCount = await countDocumentsStore( { 'clientId': { $in: req.body.clientId }, 'createdAt': { $lte: date.end }, 'status': 'active' } );
14
- let yettoInstallCount = await aggregateTangoTicket( [
15
+ let storecountQuery ={ 'clientId': { $in: req.body.clientId }, 'createdAt': { $lte: date.end }, 'status': 'active' };
16
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
17
+ storecountQuery = { ...storecountQuery, ...{ storeId: { $in: req.body.permittedStores } } };
18
+ }
19
+ let storeCount = await countDocumentsStore( storecountQuery );
20
+ let yetToInstallQuery = [
15
21
  {
16
22
  $match: {
17
23
  $and: [
@@ -22,18 +28,38 @@ export async function infraCard( req, res ) {
22
28
  ],
23
29
  },
24
30
  },
25
- ] );
31
+ ];
32
+
33
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
34
+ yetToInstallQuery.push(
35
+ {
36
+ $match: {
37
+ 'basicDetails.storeId': { $in: req.body.permittedStores },
38
+ },
39
+ },
40
+ );
41
+ }
42
+ let yettoInstallCount = await aggregateTangoTicket( yetToInstallQuery );
26
43
  storeCount = storeCount-yettoInstallCount.length;
27
- let totalstores = await aggregateStore( [ {
44
+ let totalStoreQuery =[ {
28
45
  $match: {
29
46
  '$and': [
30
47
  { 'clientId': { $in: req.body.clientId } },
31
- { 'edge.firstFile': true },
32
48
  { 'status': 'active' },
33
49
  { 'createdAt': { $lte: date.end } },
34
50
  ],
35
51
  },
36
- } ] );
52
+ } ];
53
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
54
+ totalStoreQuery.push(
55
+ {
56
+ $match: {
57
+ 'storeId': { $in: req.body.permittedStores },
58
+ },
59
+ },
60
+ );
61
+ }
62
+ let totalstores = await aggregateStore( totalStoreQuery );
37
63
  let totalnumberstores = [];
38
64
  for ( let store of totalstores ) {
39
65
  totalnumberstores.push( store.storeId );
@@ -46,7 +72,6 @@ export async function infraCard( req, res ) {
46
72
  { status: { $ne: 'closed' } },
47
73
  { 'basicDetails.clientId': { $in: req.body.clientId } },
48
74
  { 'basicDetails.storeId': { $in: totalnumberstores } },
49
- // { createdAt: { $gte: date.start } },
50
75
  { createdAt: { $lte: date.end } },
51
76
  ],
52
77
  },
@@ -83,7 +108,6 @@ export async function infraCard( req, res ) {
83
108
  { 'ticketDetails.issueStatus': 'identified' },
84
109
  { 'basicDetails.clientId': { $in: req.body.clientId } },
85
110
  { 'basicDetails.storeId': { $in: totalnumberstores } },
86
- // { createdAt: { $gte: date.start } },
87
111
  { createdAt: { $lte: date.end } },
88
112
  ],
89
113
  },
@@ -178,7 +202,7 @@ export async function infraCard( req, res ) {
178
202
  } );
179
203
  res.sendSuccess( {
180
204
  total: storeCount,
181
- liveStoreCount: infraStoreCount.length > 0 ? storeCount - infraStoreCount[0].infraCount : 0,
205
+ liveStoreCount: infraStoreCount.length > 0 ? storeCount - infraStoreCount[0].infraCount : storeCount,
182
206
  infraStoreCount: infraStoreCount.length > 0 ? infraStoreCount[0].infraCount : 0,
183
207
  identifiedcount: infraStoreCount.length > 0 ? infraStoreCount[0].identifiedcount : 0,
184
208
  notidentifiedcount: infraStoreCount.length > 0 ? infraStoreCount[0].infraCount - infraStoreCount[0].identifiedcount : 0,
@@ -192,23 +216,22 @@ export async function infraCard( req, res ) {
192
216
  export async function installationCard( req, res ) {
193
217
  try {
194
218
  let date = await getUTC( new Date( req.body.fromDate ), new Date( req.body.toDate ) );
195
- let onboardedCount = await countDocumentsStore( {
196
- '$and': [
197
- { 'clientId': { $in: req.body.clientId } },
198
- { 'createdAt': { $lte: date.end } },
199
- ],
200
- } );
201
- let installedCount = await countDocumentsStore( {
202
- 'clientId': { $in: req.body.clientId },
203
- 'status': 'active',
204
- 'createdAt': { $lte: date.end },
205
- } );
206
- let deactiveCount = await countDocumentsStore( {
207
- 'clientId': { $in: req.body.clientId },
208
- 'status': 'deactive',
209
- 'createdAt': { $lte: date.end },
210
- } );
211
- let yettoInstallCount = await aggregateTangoTicket( [
219
+ let baseQuery = {
220
+ clientId: { $in: req.body.clientId },
221
+ createdAt: { $lte: date.end },
222
+ };
223
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
224
+ baseQuery = { ...baseQuery, ...{ storeId: { $in: req.body.permittedStores } } };
225
+ }
226
+ let onboardQuery = { ...baseQuery };
227
+ let installedQuery = { ...baseQuery, status: 'active' };
228
+ let deactiveQuery = { ...baseQuery, status: 'deactive' };
229
+ let onboardedCount = await countDocumentsStore( onboardQuery );
230
+ let installedCount = await countDocumentsStore( installedQuery );
231
+ let deactiveCount = await countDocumentsStore( deactiveQuery );
232
+
233
+
234
+ let ticketbaseQuery = [
212
235
  {
213
236
  $match: {
214
237
  $and: [
@@ -219,16 +242,21 @@ export async function installationCard( req, res ) {
219
242
  ],
220
243
  },
221
244
  },
222
- ] );
223
- let query = [ {
245
+ ];
246
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
247
+ ticketbaseQuery.push(
248
+ {
249
+ $match: {
250
+ 'basicDetails.storeId': { $in: req.body.permittedStores },
251
+ },
252
+ },
253
+ );
254
+ }
255
+ let yettoInstallCount = await aggregateTangoTicket( ticketbaseQuery );
256
+ let query = ticketbaseQuery;
257
+ query.push( {
224
258
  $match: {
225
- $and: [
226
- { issueType: 'installation' },
227
- { 'status': { $ne: 'closed' } },
228
- { 'basicDetails.clientId': { $in: req.body.clientId } },
229
- { 'ticketDetails.issueStatus': 'identified' },
230
- { createdAt: { $lte: date.end } },
231
- ],
259
+ 'ticketDetails.issueStatus': 'identified',
232
260
  },
233
261
  },
234
262
  {
@@ -272,8 +300,8 @@ export async function installationCard( req, res ) {
272
300
  issueIdentifiedBy: { $last: '$issueIdentifiedBy' },
273
301
  primaryIssue: { $last: '$primaryIssue' },
274
302
  },
275
- },
276
- ];
303
+ } );
304
+
277
305
  let installFailedCount = await aggregateTangoTicket( query );
278
306
 
279
307
  let issueList = await findinfraReason( { parentId: { '$exists': false } } );
@@ -323,8 +351,7 @@ export async function infraIssuesTable( req, res ) {
323
351
  issueStatus = [ 'identified' ];
324
352
  };
325
353
 
326
-
327
- let totalstores = await aggregateStore( [ {
354
+ let totalStoreQuery = [ {
328
355
  $match: {
329
356
  '$and': [
330
357
  { 'clientId': { $in: req.body.clientId } },
@@ -332,7 +359,17 @@ export async function infraIssuesTable( req, res ) {
332
359
  { 'createdAt': { $lte: date.end } },
333
360
  ],
334
361
  },
335
- } ] );
362
+ } ];
363
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
364
+ totalStoreQuery.push(
365
+ {
366
+ $match: {
367
+ 'storeId': { $in: req.body.permittedStores },
368
+ },
369
+ },
370
+ );
371
+ }
372
+ let totalstores = await aggregateStore( totalStoreQuery );
336
373
  let totalnumberstores = [];
337
374
  for ( let store of totalstores ) {
338
375
  totalnumberstores.push( store.storeId );
@@ -348,6 +385,15 @@ export async function infraIssuesTable( req, res ) {
348
385
  ],
349
386
  },
350
387
  } );
388
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
389
+ pendingquery.push(
390
+ {
391
+ $match: {
392
+ 'basicDetails.storeId': { $in: req.body.permittedStores },
393
+ },
394
+ },
395
+ );
396
+ }
351
397
  let pendingstorecount = await aggregateTangoTicket( pendingquery );
352
398
  let installpendingticket = pendingstorecount.map( ( store ) => store.basicDetails.storeId );
353
399
 
@@ -439,6 +485,7 @@ export async function infraIssuesTable( req, res ) {
439
485
  ];
440
486
 
441
487
  let storesQuery = [];
488
+
442
489
  if ( req.body.infrafilterIssue == 'Total Stores' ) {
443
490
  storesQuery.push( {
444
491
  $match: {
@@ -461,7 +508,6 @@ export async function infraIssuesTable( req, res ) {
461
508
  !infraissueStore.includes( data ) &&
462
509
  !installpendingticket.includes( data ),
463
510
  );
464
-
465
511
  storesQuery.push(
466
512
  {
467
513
  $match: {
@@ -471,6 +517,28 @@ export async function infraIssuesTable( req, res ) {
471
517
  },
472
518
  },
473
519
  );
520
+
521
+ if ( infraissueStore&&infraissueStore.length==0 ) {
522
+ storesQuery = [ {
523
+ $match: {
524
+ '$and': [
525
+ { 'clientId': { $in: req.body.clientId } },
526
+ { 'status': 'active' },
527
+ { 'storeId': { $nin: installpendingticket } },
528
+ { 'createdAt': { $lte: date.end } },
529
+ ],
530
+ },
531
+ } ];
532
+ }
533
+ }
534
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
535
+ storesQuery.push(
536
+ {
537
+ $match: {
538
+ 'storeId': { $in: req.body.permittedStores },
539
+ },
540
+ },
541
+ );
474
542
  }
475
543
  const excludedIssues = [ 'Identified Issues', 'Issues Not Identified', 'All Issues' ];
476
544
  if ( req.body.infrafilterIssue && !excludedIssues.includes( req.body.infrafilterIssue ) ) {
@@ -628,6 +696,15 @@ export async function InstallationIssuesTable( req, res ) {
628
696
  ],
629
697
  },
630
698
  } );
699
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
700
+ query.push(
701
+ {
702
+ $match: {
703
+ 'basicDetails.storeId': { $in: req.body.permittedStores },
704
+ },
705
+ },
706
+ );
707
+ }
631
708
  if ( req.body.installtionfilterIssue == 'yettoInstallStores' ) {
632
709
  query.push( { $match: { 'ticketDetails.issueStatus': 'notidentified' } } );
633
710
  }
@@ -687,7 +764,15 @@ export async function InstallationIssuesTable( req, res ) {
687
764
  },
688
765
  );
689
766
  let storesQuery = [];
690
-
767
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
768
+ storesQuery.push(
769
+ {
770
+ $match: {
771
+ 'storeId': { $in: req.body.permittedStores },
772
+ },
773
+ },
774
+ );
775
+ }
691
776
  if ( req.body.installtionfilterIssue == 'onboardedStores' ) {
692
777
  storesQuery.push( {
693
778
  $match: {
@@ -1017,7 +1102,7 @@ export async function hourWiseDownstores( req, res ) {
1017
1102
  };
1018
1103
 
1019
1104
 
1020
- let totalstores = await aggregateStore( [ {
1105
+ let totalStoreQuery = [ {
1021
1106
  $match: {
1022
1107
  '$and': [
1023
1108
  { 'clientId': { $in: req.body.clientId } },
@@ -1025,7 +1110,17 @@ export async function hourWiseDownstores( req, res ) {
1025
1110
  { 'createdAt': { $lte: date.end } },
1026
1111
  ],
1027
1112
  },
1028
- } ] );
1113
+ } ];
1114
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
1115
+ totalStoreQuery.push(
1116
+ {
1117
+ $match: {
1118
+ 'storeId': { $in: req.body.permittedStores },
1119
+ },
1120
+ },
1121
+ );
1122
+ }
1123
+ let totalstores = await aggregateStore( totalStoreQuery );
1029
1124
  let totalnumberstores = [];
1030
1125
  for ( let store of totalstores ) {
1031
1126
  totalnumberstores.push( store.storeId );
@@ -1041,6 +1136,15 @@ export async function hourWiseDownstores( req, res ) {
1041
1136
  ],
1042
1137
  },
1043
1138
  } );
1139
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
1140
+ pendingquery.push(
1141
+ {
1142
+ $match: {
1143
+ 'basicDetails.storeId': { $in: req.body.permittedStores },
1144
+ },
1145
+ },
1146
+ );
1147
+ }
1044
1148
  let pendingstorecount = await aggregateTangoTicket( pendingquery );
1045
1149
  let installpendingticket = pendingstorecount.map( ( store ) => store.basicDetails.storeId );
1046
1150
 
@@ -1164,6 +1268,27 @@ export async function hourWiseDownstores( req, res ) {
1164
1268
  },
1165
1269
  },
1166
1270
  );
1271
+ if ( infraissueStore&&infraissueStore.length==0 ) {
1272
+ storesQuery = [ {
1273
+ $match: {
1274
+ '$and': [
1275
+ { 'clientId': { $in: req.body.clientId } },
1276
+ { 'status': 'active' },
1277
+ { 'storeId': { $nin: installpendingticket } },
1278
+ { 'createdAt': { $lte: date.end } },
1279
+ ],
1280
+ },
1281
+ } ];
1282
+ }
1283
+ }
1284
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
1285
+ storesQuery.push(
1286
+ {
1287
+ $match: {
1288
+ 'storeId': { $in: req.body.permittedStores },
1289
+ },
1290
+ },
1291
+ );
1167
1292
  }
1168
1293
  const excludedIssues = [ 'Identified Issues', 'Issues Not Identified', 'All Issues' ];
1169
1294
  if ( req.body.infrafilterIssue && !excludedIssues.includes( req.body.infrafilterIssue ) ) {
@@ -1278,6 +1403,7 @@ export async function hourWiseDownstores( req, res ) {
1278
1403
  for ( const store of storesList ) {
1279
1404
  data.storeId = store.storeId;
1280
1405
  data.storeName = store.storeName;
1406
+ data.clientName = store.clientName;
1281
1407
  data.primaryIssue = store.primaryIssue;
1282
1408
  let storedata = await downStoresCheck( data, inputData );
1283
1409
  result.push( storedata[0] );
@@ -1363,6 +1489,9 @@ export async function ticketCountSplit( req, res ) {
1363
1489
  { issueType: { $in: [ 'highcount', 'lowcount' ] } },
1364
1490
 
1365
1491
  ];
1492
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
1493
+ filter.push( { 'basicDetails.storeId': { $in: req.body.permittedStores } } );
1494
+ }
1366
1495
  if ( req.user.userType === 'client' ) {
1367
1496
  filter.push( { 'dataMismatch.showToClient': true } );
1368
1497
  }
@@ -1441,6 +1570,9 @@ export async function overViewTable( req, res ) {
1441
1570
  'basicDetails.clientId': { $in: inputData.clientId },
1442
1571
  },
1443
1572
  ];
1573
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
1574
+ filter.push( { 'basicDetails.storeId': { $in: req.body.permittedStores } } );
1575
+ }
1444
1576
  if ( req.user.userType === 'client' ) {
1445
1577
  filter.push( { 'dataMismatch.showToClient': true } );
1446
1578
  }
@@ -1536,7 +1668,9 @@ export async function ticketCount( req, res ) {
1536
1668
  },
1537
1669
 
1538
1670
  ];
1539
-
1671
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
1672
+ filter.push( { 'basicDetails.storeId': { $in: req.body.permittedStores } } );
1673
+ }
1540
1674
  if ( req.user.userType === 'client' ) {
1541
1675
  filter.push( { 'dataMismatch.showToClient': true } );
1542
1676
  }
@@ -1598,3 +1732,108 @@ export async function ticketCount( req, res ) {
1598
1732
  res.sendError( 'Internal Server Error', 500 );
1599
1733
  }
1600
1734
  };
1735
+ export async function checkPermission( req, res, next ) {
1736
+ try {
1737
+ let result =[];
1738
+ if ( req.user.role !== 'superadmin' && req.user.userType == 'client' ) {
1739
+ const assignedUser = await findUserAssignedStore( { userEmail: req.user.email } );
1740
+ if ( assignedUser.length == 0 ) {
1741
+ return res.sendSuccess( { result: [], count: 0 } );
1742
+ }
1743
+ switch ( assignedUser[0].assignedType ) {
1744
+ case 'store':
1745
+ const assignedUserQuery = [
1746
+ {
1747
+ $match: {
1748
+ userEmail: { $eq: req.user.email },
1749
+ },
1750
+
1751
+ },
1752
+ {
1753
+ $group: {
1754
+ _id: null,
1755
+ storeList: { $push: '$assignedValue' },
1756
+ },
1757
+ },
1758
+ {
1759
+ $project: {
1760
+ storeList: 1,
1761
+ },
1762
+ },
1763
+ ];
1764
+ result = await aggregateUserAssignedStore( assignedUserQuery );
1765
+ break;
1766
+
1767
+ case 'group':
1768
+ const assignedQuery = [
1769
+ {
1770
+ $match: {
1771
+ userEmail: { $eq: req.user.email },
1772
+ },
1773
+
1774
+ },
1775
+ {
1776
+ $project: {
1777
+ assignedValue: {
1778
+ $toObjectId: '$assignedValue',
1779
+ },
1780
+ },
1781
+ },
1782
+ {
1783
+ $lookup: {
1784
+ from: 'groups',
1785
+ let: { groupId: '$assignedValue' },
1786
+ pipeline: [
1787
+ {
1788
+ $match: {
1789
+ $expr: {
1790
+ $eq: [ '$_id', '$$groupId' ],
1791
+ },
1792
+ },
1793
+ },
1794
+ {
1795
+ $project: {
1796
+ _id: 0,
1797
+ storeList: 1,
1798
+ },
1799
+ },
1800
+ ], as: 'groups',
1801
+ },
1802
+ },
1803
+ {
1804
+ $unwind: {
1805
+ path: '$groups', preserveNullAndEmptyArrays: true,
1806
+ },
1807
+ },
1808
+ {
1809
+ $unwind: {
1810
+ path: '$groups.storeList', preserveNullAndEmptyArrays: true,
1811
+ },
1812
+ },
1813
+ {
1814
+ $group: {
1815
+ _id: null,
1816
+ stores: { $push: '$groups.storeList' },
1817
+ },
1818
+ },
1819
+ {
1820
+ $project: {
1821
+ _id: 0,
1822
+ storeList: '$stores',
1823
+ },
1824
+ },
1825
+ ];
1826
+ result = await aggregateUserAssignedStore( assignedQuery );
1827
+ break;
1828
+ }
1829
+ if ( result&&result.length>0 ) {
1830
+ const uniqueArray = [ ...new Set( result[0].storeList ) ];
1831
+ req.body.permittedStores =uniqueArray;
1832
+ }
1833
+ }
1834
+ next();
1835
+ } catch ( error ) {
1836
+ logger.error( { error: error, function: 'checkPermission' } );
1837
+ res.sendError( 'Internal Server Error', 500 );
1838
+ }
1839
+ };
@@ -1,5 +1,5 @@
1
1
 
2
- import { findOneTangoTicket, createTangoTicket, updateOneTangoTicket, aggregateTangoTicket, countDocumentsTangoTicket } from '../services/tangoTicket.service.js';
2
+ import { findOneTangoTicket, createTangoTicket, updateOneTangoTicket, aggregateTangoTicket, countDocumentsTangoTicket, findTangoTicket } from '../services/tangoTicket.service.js';
3
3
  import { logger, getUTC, fileUpload, signedUrl, sendMessageToQueue, listFileByPath } from 'tango-app-api-middleware';
4
4
  import dayjs from 'dayjs';
5
5
 
@@ -11,6 +11,25 @@ export async function createTicket( req, res ) {
11
11
  return res.sendError( 'Ticket Already Exists for the store', 400 );
12
12
  }
13
13
 
14
+ let date = await getUTC( new Date( ), new Date( ) );
15
+
16
+ let clientTickets = await findTangoTicket(
17
+ {
18
+ $and: [
19
+ { 'basicDetails.clientId': req.body.basicDetails.clientId },
20
+ { issueType: { $in: [ 'lowcount', 'highcount' ] } },
21
+ { createdAt: { $gte: date.start } },
22
+ { createdAt: { $lte: date.end } },
23
+ ],
24
+ },
25
+ );
26
+
27
+
28
+ if ( clientTickets.length > 50 ) {
29
+ return res.sendError( 'Ticket limit exceeded for the day', 400 );
30
+ }
31
+
32
+
14
33
  let param = {
15
34
  Bucket: JSON.parse( process.env.BUCKET ).auditInput,
16
35
  file_path: `${dayjs( new Date( req.body.Date ) ).format( 'DD-MM-YYYY' )}/${req.body.storeId}/`,
@@ -200,7 +219,7 @@ export async function activityList( req, res ) {
200
219
  if ( req.user.userType === 'client' ) {
201
220
  query.forEach( ( e ) => {
202
221
  if ( e.$match ) {
203
- $match.$and.push( { 'dataMismatch.showToClient': true } );
222
+ e.$match.$and.push( { 'dataMismatch.showToClient': true } );
204
223
  }
205
224
  } );
206
225
  }
@@ -14,6 +14,7 @@ import { findOneGroup } from '../services/group.service.js';
14
14
  import htmlpdf from 'html-pdf-node';
15
15
  import mongoose from 'mongoose';
16
16
  import _ from 'lodash';
17
+ import { aggregateUserAssignedStore, findUserAssignedStore } from '../services/userAssignedStore.service.js';
17
18
  import { aggregateCamera } from '../services/camera.service.js';
18
19
  export async function createTicket( req, res ) {
19
20
  try {
@@ -72,7 +73,6 @@ export async function createTicket( req, res ) {
72
73
  downtimetotal = 0;
73
74
  }
74
75
 
75
- console.log( req.body );
76
76
  let create = await createTangoTicket( req.body );
77
77
  let Timestamp = dayjs().format( 'YYYY-MM-DD HH:mm' );
78
78
  const attachments = null;
@@ -242,11 +242,11 @@ export async function updateTicketIssue( req, res ) {
242
242
  if ( req.body.issueType === 'infra' ) {
243
243
  let client = await findOneClient( { clientId: req.body.basicDetails.clientId } );
244
244
  let refreshdate = dayjs().add( client.ticketConfigs.refreshAlert, 'days' );
245
- console.log( new Date( dayjs( refreshdate ).format( 'YYYY-MM-DD' ) ) );
245
+
246
246
  query = { ...query, 'ticketDetails.ticketRefreshTime': new Date( dayjs( refreshdate ).format( 'YYYY-MM-DD' ) ),
247
247
  };
248
248
  }
249
- console.log( query );
249
+
250
250
  let updateTicket = await updateOneTangoTicket( { ticketId: req.body.ticketId }, query );
251
251
 
252
252
  if ( req.body.ticketDetails.ticketType === 'refreshticket' ) {
@@ -937,49 +937,83 @@ function inWords( num ) {
937
937
  export async function allCounts( req, res ) {
938
938
  try {
939
939
  let date = await getUTC( new Date( req.body.fromDate ), new Date( req.body.toDate ) );
940
- let countQuery=[
941
- {
942
- $match: {
943
- $and: [
944
- { 'basicDetails.clientId': { $in: req.body.clientId } },
945
- { createdAt: { $gte: date.start } },
946
- { createdAt: { $lte: date.end } },
940
+ let countQuery=[];
941
+
942
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
943
+ countQuery.push(
944
+ {
945
+ $match: {
946
+ 'basicDetails.storeId': { $in: req.body.permittedStores },
947
+ },
948
+ },
949
+ );
950
+ }
951
+
952
+ countQuery.push( {
953
+ $match: {
954
+ $and: [
955
+ { 'basicDetails.clientId': { $in: req.body.clientId } },
956
+ { createdAt: { $gte: date.start } },
957
+ { createdAt: { $lte: date.end } },
958
+ ],
959
+ },
960
+ },
961
+ {
962
+ $project: {
963
+ issueType: 1,
964
+ installationCount: {
965
+ $cond: [ { $and: [ { $eq: [ '$issueType', 'installation' ] } ] }, 1, 0,
947
966
  ],
948
967
  },
949
- },
950
- {
951
- $project: {
952
- issueType: 1,
953
- installationCount: {
954
- $cond: [ { $and: [ { $eq: [ '$issueType', 'installation' ] } ] }, 1, 0,
955
- ],
956
- },
957
- infraCount: {
958
- $cond: [ { $and: [ { $eq: [ '$issueType', 'infra' ] } ] }, 1, 0,
959
- ],
960
- },
961
- datamismatchCount: {
962
- $cond: [ { $or: [ { $eq: [ '$issueType', 'highcount' ] }, { $eq: [ '$issueType', 'lowcount' ] } ] }, 1, 0,
963
- ],
964
- },
965
- matCount: {
966
- $cond: [ { $and: [ { $eq: [ '$issueType', 'mat' ] } ] }, 1, 0,
967
- ],
968
- },
968
+ infraCount: {
969
+ $cond: [ { $and: [ { $eq: [ '$issueType', 'infra' ] } ] }, 1, 0,
970
+ ],
971
+ },
972
+ datamismatchCount: {
973
+ $cond: [ { $or: [ { $eq: [ '$issueType', 'highcount' ] }, { $eq: [ '$issueType', 'lowcount' ] } ] }, 1, 0,
974
+ ],
975
+
976
+ },
977
+ matCount: {
978
+ $cond: [ { $and: [ { $eq: [ '$issueType', 'mat' ] } ] }, 1, 0,
979
+ ],
969
980
  },
970
981
  },
971
- {
972
- $group: {
973
- _id: null,
974
- installationCount: { $sum: '$installationCount' },
975
- infraCount: { $sum: '$infraCount' },
976
- datamismatchCount: { $sum: '$datamismatchCount' },
977
- matCount: { $sum: '$matCount' },
982
+ },
983
+ {
984
+ $group: {
985
+ _id: null,
986
+ installationCount: { $sum: '$installationCount' },
987
+ infraCount: { $sum: '$infraCount' },
988
+ datamismatchCount: { $sum: '$datamismatchCount' },
989
+ matCount: { $sum: '$matCount' },
978
990
 
979
991
 
980
- },
981
992
  },
982
- ];
993
+ } );
994
+
995
+
996
+ if ( req.user.userType === 'client' ) {
997
+ countQuery.forEach( ( item ) => {
998
+ if ( item.$project ) {
999
+ item.$project.datamismatchCount.$cond = [
1000
+ {
1001
+ $and: [
1002
+ {
1003
+ $or: [
1004
+ { $eq: [ '$issueType', 'highcount' ] },
1005
+ { $eq: [ '$issueType', 'lowcount' ] },
1006
+ ],
1007
+ },
1008
+ { $eq: [ '$dataMismatch.showToClient', true ] },
1009
+ ],
1010
+ },
1011
+ 1,
1012
+ 0,
1013
+ ];
1014
+ }
1015
+ } );
1016
+ }
983
1017
  let result = await aggregateTangoTicket( countQuery );
984
1018
  res.sendSuccess( result );
985
1019
  } catch ( error ) {
@@ -999,6 +1033,15 @@ export async function infraTable( req, res ) {
999
1033
  },
1000
1034
  } );
1001
1035
  }
1036
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
1037
+ query.push(
1038
+ {
1039
+ $match: {
1040
+ 'basicDetails.storeId': { $in: req.body.permittedStores },
1041
+ },
1042
+ },
1043
+ );
1044
+ }
1002
1045
  query.push( {
1003
1046
  $match: {
1004
1047
  $and: [
@@ -1249,21 +1292,37 @@ export async function infraTable( req, res ) {
1249
1292
  let result = await aggregateTangoTicket( query );
1250
1293
  if ( req.body.export && result.length > 0 ) {
1251
1294
  const exportdata = [];
1252
- result.forEach( ( element ) => {
1253
- exportdata.push( {
1254
- 'Ticket ID': element.ticketId,
1255
- 'Created Date': dayjs( element.issueDate ).format( 'DD MMM, YYYY' ),
1256
- 'Brand Name': element.clientName,
1257
- 'Brand ID': element.clientId,
1258
- 'Store Name': element.storeName,
1259
- 'Store ID': element.storeId,
1260
- 'Resloved By': element.userName,
1261
- 'Status': element.status,
1262
- 'Primary Issues': element.primaryIssue,
1263
- 'Secondary Issues': element.secondaryIssue,
1264
- 'Comment': element.otherscomment ? element.otherscomment : ( element.commentText?element.commentText:'-' ),
1295
+ if ( req.user.userType ==='tango' ) {
1296
+ result.forEach( ( element ) => {
1297
+ exportdata.push( {
1298
+ 'Ticket ID': element.ticketId,
1299
+ 'Created Date': dayjs( element.issueDate ).format( 'DD MMM, YYYY' ),
1300
+ 'Brand Name': element.clientName,
1301
+ 'Brand ID': element.clientId,
1302
+ 'Store Name': element.storeName,
1303
+ 'Store ID': element.storeId,
1304
+ 'Resloved By': element.userName,
1305
+ 'Status': element.status,
1306
+ 'Primary Issues': element.primaryIssue,
1307
+ 'Secondary Issues': element.secondaryIssue,
1308
+ 'Comment': element.otherscomment ? element.otherscomment : ( element.commentText?element.commentText:'-' ),
1309
+ } );
1265
1310
  } );
1266
- } );
1311
+ } else {
1312
+ result.forEach( ( element ) => {
1313
+ exportdata.push( {
1314
+ 'Ticket ID': element.ticketId,
1315
+ 'Created Date': dayjs( element.issueDate ).format( 'DD MMM, YYYY' ),
1316
+ 'Store Name': element.storeName,
1317
+ 'Store ID': element.storeId,
1318
+ 'Status': element.status,
1319
+ 'Primary Issues': element.primaryIssue,
1320
+ 'Secondary Issues': element.secondaryIssue,
1321
+ 'Comment': element.otherscomment ? element.otherscomment : ( element.commentText?element.commentText:'-' ),
1322
+ } );
1323
+ } );
1324
+ }
1325
+
1267
1326
  await download( exportdata, res );
1268
1327
  return;
1269
1328
  }
@@ -1288,6 +1347,15 @@ export async function installationTable( req, res ) {
1288
1347
  },
1289
1348
  } );
1290
1349
  }
1350
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
1351
+ query.push(
1352
+ {
1353
+ $match: {
1354
+ 'basicDetails.storeId': { $in: req.body.permittedStores },
1355
+ },
1356
+ },
1357
+ );
1358
+ }
1291
1359
 
1292
1360
  query.push( {
1293
1361
  $match: {
@@ -1530,20 +1598,34 @@ export async function installationTable( req, res ) {
1530
1598
 
1531
1599
  if ( req.body.export && result.length > 0 ) {
1532
1600
  const exportdata = [];
1533
- result.forEach( ( element ) => {
1534
- exportdata.push( {
1535
- 'Ticket ID': element.ticketId,
1536
- 'Created Date': dayjs( element.createdAt ).format( 'DD MMM, YYYY' ),
1537
- 'Brand Name': element.clientName,
1538
- 'Brand ID': element.clientId,
1539
- 'Store Name': element.storeName,
1540
- 'Store ID': element.storeId,
1541
- 'Installed By': element.userName,
1542
- 'Deployed Status': element.installationStatus,
1543
- 'Primary Issues': element.primaryIssue=='-'?'Issue not identified':element.primaryIssue,
1544
- 'Secondary Issues': element.secondaryIssue,
1601
+ if ( req.user.userType ==='tango' ) {
1602
+ result.forEach( ( element ) => {
1603
+ exportdata.push( {
1604
+ 'Ticket ID': element.ticketId,
1605
+ 'Created Date': dayjs( element.createdAt ).format( 'DD MMM, YYYY' ),
1606
+ 'Brand Name': element.clientName,
1607
+ 'Brand ID': element.clientId,
1608
+ 'Store Name': element.storeName,
1609
+ 'Store ID': element.storeId,
1610
+ 'Installed By': element.userName,
1611
+ 'Deployed Status': element.installationStatus,
1612
+ 'Primary Issues': element.primaryIssue=='-'?'Issue not identified':element.primaryIssue,
1613
+ 'Secondary Issues': element.secondaryIssue,
1614
+ } );
1545
1615
  } );
1546
- } );
1616
+ } else {
1617
+ result.forEach( ( element ) => {
1618
+ exportdata.push( {
1619
+ 'Ticket ID': element.ticketId,
1620
+ 'Created Date': dayjs( element.createdAt ).format( 'DD MMM, YYYY' ),
1621
+ 'Store Name': element.storeName,
1622
+ 'Store ID': element.storeId,
1623
+ 'Deployed Status': element.installationStatus,
1624
+ 'Primary Issues': element.primaryIssue=='-'?'Issue not identified':element.primaryIssue,
1625
+ 'Secondary Issues': element.secondaryIssue,
1626
+ } );
1627
+ } );
1628
+ }
1547
1629
  await download( exportdata, res );
1548
1630
  return;
1549
1631
  }
@@ -1775,6 +1857,15 @@ export async function dataMismatchTable( req, res ) {
1775
1857
  },
1776
1858
 
1777
1859
  ];
1860
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
1861
+ countFilter.push(
1862
+ { 'basicDetails.storeId': { $in: req.body.permittedStores } },
1863
+ );
1864
+ }
1865
+
1866
+ if ( req.user.userType === 'client' ) {
1867
+ countFilter.push( { 'dataMismatch.showToClient': true } );
1868
+ }
1778
1869
  if ( inputData.clientId && inputData?.clientId?.length > 0 ) {
1779
1870
  countFilter.push( {
1780
1871
  'basicDetails.clientId': { $in: inputData.clientId },
@@ -1836,6 +1927,14 @@ export async function dataMismatchTable( req, res ) {
1836
1927
  { 'basicDetails.clientId': { $in: inputData.clientId } },
1837
1928
  { issueType: { $in: [ 'highcount', 'lowcount' ] } },
1838
1929
  ];
1930
+ if ( req.body.permittedStores && req.body.permittedStores.length > 0 ) {
1931
+ filter.push(
1932
+ { 'basicDetails.storeId': { $in: req.body.permittedStores } },
1933
+ );
1934
+ }
1935
+ if ( req.user.userType === 'client' ) {
1936
+ filter.push( { 'dataMismatch.showToClient': true } );
1937
+ }
1839
1938
  const query = [
1840
1939
  {
1841
1940
  $match: {
@@ -2036,3 +2135,109 @@ export async function dataMismatchTable( req, res ) {
2036
2135
  res.sendError( 'Internal Server Error', 500 );
2037
2136
  }
2038
2137
  };
2138
+
2139
+ export async function checkPermission( req, res, next ) {
2140
+ try {
2141
+ let result =[];
2142
+ if ( req.user.role !== 'superadmin' && req.user.userType == 'client' ) {
2143
+ const assignedUser = await findUserAssignedStore( { userEmail: req.user.email } );
2144
+ if ( assignedUser.length == 0 ) {
2145
+ return res.sendSuccess( { result: [], count: 0 } );
2146
+ }
2147
+ switch ( assignedUser[0].assignedType ) {
2148
+ case 'store':
2149
+ const assignedUserQuery = [
2150
+ {
2151
+ $match: {
2152
+ userEmail: { $eq: req.user.email },
2153
+ },
2154
+
2155
+ },
2156
+ {
2157
+ $group: {
2158
+ _id: null,
2159
+ storeList: { $push: '$assignedValue' },
2160
+ },
2161
+ },
2162
+ {
2163
+ $project: {
2164
+ storeList: 1,
2165
+ },
2166
+ },
2167
+ ];
2168
+ result = await aggregateUserAssignedStore( assignedUserQuery );
2169
+ break;
2170
+
2171
+ case 'group':
2172
+ const assignedQuery = [
2173
+ {
2174
+ $match: {
2175
+ userEmail: { $eq: req.user.email },
2176
+ },
2177
+
2178
+ },
2179
+ {
2180
+ $project: {
2181
+ assignedValue: {
2182
+ $toObjectId: '$assignedValue',
2183
+ },
2184
+ },
2185
+ },
2186
+ {
2187
+ $lookup: {
2188
+ from: 'groups',
2189
+ let: { groupId: '$assignedValue' },
2190
+ pipeline: [
2191
+ {
2192
+ $match: {
2193
+ $expr: {
2194
+ $eq: [ '$_id', '$$groupId' ],
2195
+ },
2196
+ },
2197
+ },
2198
+ {
2199
+ $project: {
2200
+ _id: 0,
2201
+ storeList: 1,
2202
+ },
2203
+ },
2204
+ ], as: 'groups',
2205
+ },
2206
+ },
2207
+ {
2208
+ $unwind: {
2209
+ path: '$groups', preserveNullAndEmptyArrays: true,
2210
+ },
2211
+ },
2212
+ {
2213
+ $unwind: {
2214
+ path: '$groups.storeList', preserveNullAndEmptyArrays: true,
2215
+ },
2216
+ },
2217
+ {
2218
+ $group: {
2219
+ _id: null,
2220
+ stores: { $push: '$groups.storeList' },
2221
+ },
2222
+ },
2223
+ {
2224
+ $project: {
2225
+ _id: 0,
2226
+ storeList: '$stores',
2227
+ },
2228
+ },
2229
+ ];
2230
+ result = await aggregateUserAssignedStore( assignedQuery );
2231
+ break;
2232
+ }
2233
+ if ( result&&result.length>0 ) {
2234
+ const uniqueArray = [ ...new Set( result[0].storeList ) ];
2235
+ req.body.permittedStores =uniqueArray;
2236
+ }
2237
+ }
2238
+ next();
2239
+ } catch ( error ) {
2240
+ logger.error( { error: error, function: 'checkPermission' } );
2241
+ res.sendError( 'Internal Server Error', 500 );
2242
+ }
2243
+ };
@@ -1047,11 +1047,15 @@ export async function updateIssue( data ) {
1047
1047
  statusCheckAlertTime: statusCheckAlertTime,
1048
1048
  } );
1049
1049
  }
1050
+ let client = await findOneClient( { clientId: req.body.basicDetails.clientId } );
1051
+ let refreshdate = dayjs().add( client.ticketConfigs.refreshAlert, 'days' );
1052
+
1050
1053
  let query = {
1051
1054
  'ticketActivity': data.ticketActivity,
1052
1055
  'ticketDetails.issueIdentifiedDate': new Date(),
1053
1056
  'ticketDetails.issueStatus': 'identified',
1054
1057
  'status': 'inprogress',
1058
+ 'ticketDetails.ticketRefreshTime': new Date( dayjs( refreshdate ).format( 'YYYY-MM-DD' ) )
1055
1059
  };
1056
1060
  await updateOneTangoTicket( { ticketId: data.ticketId }, query );
1057
1061
  } catch ( error ) {
@@ -401,7 +401,7 @@ export async function edgeAppLogTable( req, res ) {
401
401
  if ( req.body.export ) {
402
402
  const exportData = timeSlots.map( ( element ) => ( {
403
403
  'Time Stamp': `${element.startTime}-${element.endTime}`,
404
- 'Downtime': element.downtime +'Mins',
404
+ 'Downtime': element.downtime?element.downtime +' Mins':'--',
405
405
  'Avg Internet Speed': element.Internetspeed,
406
406
  'Files Generated': element.files_generated,
407
407
  'Files Pushed': element.files_pushed,
@@ -802,11 +802,11 @@ export async function pendingTicket( req, res ) {
802
802
  ],
803
803
  },
804
804
  datamismatchCount: {
805
- $cond: [ { $and: [ { $or: [ { $eq: [ '$issueType', 'highcount' ] }, { $eq: [ '$issueType', 'lowcount' ] } ] }, { $eq: [ '$status', 'closed' ] } ] }, 1, 0,
805
+ $cond: [ { $and: [ { $or: [ { $eq: [ '$issueType', 'highcount' ] }, { $eq: [ '$issueType', 'lowcount' ] } ] }, { $ne: [ '$status', 'closed' ] } ] }, 1, 0,
806
806
  ],
807
807
  },
808
808
  matCount: {
809
- $cond: [ { $and: [ { $eq: [ '$issueType', 'mat' ] }, { $eq: [ '$status', 'open' ] } ] }, 1, 0,
809
+ $cond: [ { $and: [ { $eq: [ '$issueType', 'mat' ] }, { $ne: [ '$status', 'closed' ] } ] }, 1, 0,
810
810
  ],
811
811
  },
812
812
  },
@@ -1,7 +1,7 @@
1
1
 
2
2
  import express from 'express';
3
3
  import { isAllowedSessionHandler, authorize } from 'tango-app-api-middleware';
4
- import { infraCard, installationCard, InstallationIssuesTable, infraIssuesTable, hourWiseDownClients, hourWiseDownstores, ticketCountSplit, overViewTable, ticketCount } from '../controllers/clientInfra.controller.js';
4
+ import { infraCard, installationCard, checkPermission, InstallationIssuesTable, infraIssuesTable, hourWiseDownClients, hourWiseDownstores, ticketCountSplit, overViewTable, ticketCount } from '../controllers/clientInfra.controller.js';
5
5
 
6
6
  export const clientInfraRouter = express.Router();
7
7
 
@@ -9,19 +9,19 @@ export const clientInfraRouter = express.Router();
9
9
  clientInfraRouter.post( '/infraCard', isAllowedSessionHandler, authorize( {
10
10
  userType: [ 'client', 'tango' ], access: [
11
11
  { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
12
- } ), infraCard );
12
+ } ), checkPermission, infraCard );
13
13
  clientInfraRouter.post( '/infraIssuesTable', isAllowedSessionHandler, authorize( {
14
14
  userType: [ 'client', 'tango' ], access: [
15
15
  { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
16
- } ), infraIssuesTable );
16
+ } ), checkPermission, infraIssuesTable );
17
17
  clientInfraRouter.post( '/installationCard', isAllowedSessionHandler, authorize( {
18
18
  userType: [ 'client', 'tango' ], access: [
19
19
  { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
20
- } ), installationCard );
20
+ } ), checkPermission, installationCard );
21
21
  clientInfraRouter.post( '/InstallationIssuesTable', isAllowedSessionHandler, authorize( {
22
22
  userType: [ 'client', 'tango' ], access: [
23
23
  { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
24
- } ), InstallationIssuesTable );
24
+ } ), checkPermission, InstallationIssuesTable );
25
25
  clientInfraRouter.post( '/hourWiseDownClients', isAllowedSessionHandler, authorize( {
26
26
  userType: [ 'client', 'tango' ], access: [
27
27
  { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
@@ -29,17 +29,17 @@ clientInfraRouter.post( '/hourWiseDownClients', isAllowedSessionHandler, authori
29
29
  clientInfraRouter.post( '/hourWiseDownstores', isAllowedSessionHandler, authorize( {
30
30
  userType: [ 'client', 'tango' ], access: [
31
31
  { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
32
- } ), hourWiseDownstores );
32
+ } ), checkPermission, hourWiseDownstores );
33
33
 
34
34
  clientInfraRouter.post( '/ticket-count', isAllowedSessionHandler, authorize( {
35
35
  userType: [ 'client', 'tango' ], access: [
36
36
  { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
37
- } ), ticketCount );
37
+ } ), checkPermission, ticketCount );
38
38
  clientInfraRouter.post( '/ticket-count-split', isAllowedSessionHandler, authorize( {
39
39
  userType: [ 'client', 'tango' ], access: [
40
40
  { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
41
- } ), ticketCountSplit );
41
+ } ), checkPermission, ticketCountSplit );
42
42
  clientInfraRouter.post( '/overview-table', isAllowedSessionHandler, authorize( {
43
43
  userType: [ 'client', 'tango' ], access: [
44
44
  { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
45
- } ), overViewTable );
45
+ } ), checkPermission, overViewTable );
@@ -2,7 +2,7 @@
2
2
  import express from 'express';
3
3
  import { isAllowedSessionHandler, authorize, validate } from 'tango-app-api-middleware';
4
4
  import { validateDetails, bulkvalidateDetails, validateTicket, bulkvalidateTicket, validateTicketstatus, ticketExists, infraReasonExists, InfrastepstoResolve, InfraAlert } from '../validations/infra.validation.js';
5
- import { createTicket, bulkcreateTicket, updateStatus, createReason, PrimaryReasons, matTable, removeAttachment,
5
+ import { createTicket, bulkcreateTicket, checkPermission, updateStatus, createReason, PrimaryReasons, matTable, removeAttachment,
6
6
  secondaryReason, updateTicketIssue, viewTicket, AlertTicketReply, uploadAttachments, getInfraIssues,
7
7
  updateInstallationTicket, emailUserList, saveInfraEmailConfig, invoice, allCounts, infraTable, dataMismatchTable, storeFilter, assignTicket, installationTable } from '../controllers/infra.controllers.js';
8
8
  import { getInfraIssueValid } from '../dtos/infra.dtos.js';
@@ -63,15 +63,15 @@ infraRouter.post( '/invoice', invoice );
63
63
  infraRouter.post( '/allCounts', isAllowedSessionHandler, authorize( {
64
64
  userType: [ 'client', 'tango' ], access: [
65
65
  { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
66
- } ), allCounts );
66
+ } ), checkPermission, allCounts );
67
67
  infraRouter.post( '/infraTable', isAllowedSessionHandler, authorize( {
68
68
  userType: [ 'client', 'tango' ], access: [
69
69
  { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
70
- } ), infraTable );
70
+ } ), checkPermission, infraTable );
71
71
  infraRouter.post( '/installationTable', isAllowedSessionHandler, authorize( {
72
72
  userType: [ 'client', 'tango' ], access: [
73
73
  { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
74
- } ), installationTable );
74
+ } ), checkPermission, installationTable );
75
75
  infraRouter.post( '/matTable', isAllowedSessionHandler, authorize( {
76
76
  userType: [ 'client', 'tango' ], access: [
77
77
  { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
@@ -79,7 +79,7 @@ infraRouter.post( '/matTable', isAllowedSessionHandler, authorize( {
79
79
  infraRouter.post( '/dataMismatchTable', isAllowedSessionHandler, authorize( {
80
80
  userType: [ 'client', 'tango' ], access: [
81
81
  { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
82
- } ), dataMismatchTable );
82
+ } ), checkPermission, dataMismatchTable );
83
83
  infraRouter.post( '/assignTicket', isAllowedSessionHandler, authorize( {
84
84
  userType: [ 'client', 'tango' ], access: [
85
85
  { featureName: 'manage', name: 'tickets', permissions: [ 'isEdit', 'isView' ] } ],
@@ -14,22 +14,22 @@ storeInfraRouter.post( '/storeTicketcard', isAllowedSessionHandler, authorize( {
14
14
  } ), storeTicketcard );
15
15
  storeInfraRouter.post( '/edgeAppLogTable', isAllowedSessionHandler, authorize( {
16
16
  userType: [ 'client', 'tango' ], access: [
17
- { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
17
+ { featureName: 'manage', name: 'stores', permissions: [ 'isView' ] } ],
18
18
  } ), edgeAppLogTable );
19
19
  storeInfraRouter.post( '/viewedgeAppLog', isAllowedSessionHandler, authorize( {
20
20
  userType: [ 'client', 'tango' ], access: [
21
- { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
21
+ { featureName: 'manage', name: 'stores', permissions: [ 'isView' ] } ],
22
22
  } ), viewedgeAppLog );
23
23
  storeInfraRouter.post( '/cameraAngleChange', isAllowedSessionHandler, authorize( {
24
24
  userType: [ 'client', 'tango' ], access: [
25
- { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
25
+ { featureName: 'manage', name: 'stores', permissions: [ 'isView' ] } ],
26
26
  } ), cameraAngleChange );
27
27
 
28
28
  storeInfraRouter.post( '/datewiseDowntime', isAllowedSessionHandler, authorize( {
29
29
  userType: [ 'client', 'tango' ], access: [
30
- { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
30
+ { featureName: 'manage', name: 'stores', permissions: [ 'isView' ] } ],
31
31
  } ), datewiseDowntime );
32
32
  storeInfraRouter.post( '/streamwiseDowntime', isAllowedSessionHandler, authorize( {
33
33
  userType: [ 'client', 'tango' ], access: [
34
- { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
34
+ { featureName: 'manage', name: 'stores', permissions: [ 'isView' ] } ],
35
35
  } ), streamwiseDowntime );