tango-app-api-infra 3.8.1-beta.35 → 3.8.1-beta.37

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/README.md CHANGED
@@ -1,29 +1,29 @@
1
- # README #
2
-
3
- This README would normally document whatever steps are necessary to get your application up and running.
4
-
5
- ### What is this repository for? ###
6
-
7
- * Quick summary
8
- * Version
9
- * [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
10
-
11
- ### How do I get set up? ###
12
-
13
- * Summary of set up
14
- * Configuration
15
- * Dependencies
16
- * Database configuration
17
- * How to run tests
18
- * Deployment instructions
19
-
20
- ### Contribution guidelines ###
21
-
22
- * Writing tests
23
- * Code review
24
- * Other guidelines
25
-
26
- ### Who do I talk to? ###
27
-
28
- * Repo owner or admin
1
+ # README #
2
+
3
+ This README would normally document whatever steps are necessary to get your application up and running.
4
+
5
+ ### What is this repository for? ###
6
+
7
+ * Quick summary
8
+ * Version
9
+ * [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
10
+
11
+ ### How do I get set up? ###
12
+
13
+ * Summary of set up
14
+ * Configuration
15
+ * Dependencies
16
+ * Database configuration
17
+ * How to run tests
18
+ * Deployment instructions
19
+
20
+ ### Contribution guidelines ###
21
+
22
+ * Writing tests
23
+ * Code review
24
+ * Other guidelines
25
+
26
+ ### Who do I talk to? ###
27
+
28
+ * Repo owner or admin
29
29
  * Other community or team contact
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "tango-app-api-infra",
3
- "version": "3.8.1-beta.35",
3
+ "version": "3.8.1-beta.37",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "start": "nodemon --exec \"eslint --fix . && node app.js\""
8
+ "start": "nodemon --exec \"eslint --fix . && node index.js\""
9
9
  },
10
10
  "engines": {
11
11
  "node": ">=18.10.0"
@@ -1471,6 +1471,7 @@ async function downStoresCheck( data, inputData ) {
1471
1471
  startTime: dayjs( slot.from ).format( 'hh:mm A' ),
1472
1472
  endTime: dayjs( slot.to ).format( 'hh:mm A' ),
1473
1473
  } ) );
1474
+ let downtimetotal=0;
1474
1475
 
1475
1476
  const downTimePromises = formattedTimeSlots.map( async ( obj ) => {
1476
1477
  const downTime = await getOpenSearchData(
@@ -1492,11 +1493,10 @@ async function downStoresCheck( data, inputData ) {
1492
1493
  const streamwiseDowntime = downTime.body.hits.hits.length > 0 ?
1493
1494
  downTime.body.hits.hits[0]._source.doc.streamwise_downtime :
1494
1495
  [];
1495
-
1496
1496
  const average = streamwiseDowntime.length ?
1497
1497
  Math.round( streamwiseDowntime.reduce( ( acc, curr ) => acc + curr.down_time, 0 ) / streamwiseDowntime.length ) :
1498
1498
  '';
1499
-
1499
+ downtimetotal= Number( downtimetotal ) + Number( average );
1500
1500
  return { ...obj, [`${obj.startTime}-${obj.endTime}`]: average };
1501
1501
  } );
1502
1502
 
@@ -1512,6 +1512,7 @@ async function downStoresCheck( data, inputData ) {
1512
1512
  }, {
1513
1513
  storeName: data.storeName,
1514
1514
  storeId: data.storeId,
1515
+ downtimetotal: downtimetotal,
1515
1516
  PrimaryIssue: data.primaryIssue,
1516
1517
  } );
1517
1518
 
@@ -388,8 +388,8 @@ export async function ticketList( req, res ) {
388
388
  'Employee/Staff': item?._source?.status === 'closed'? item._source.employeeACCount : item._source.employeeCount,
389
389
  'HouseKeeping': item?._source?.status === 'closed'? item._source.houseKeepingACCount : item._source.houseKeepingCount,
390
390
  'Revised Footfall': item?._source?.status === 'closed'? item._source.footfallCount - ( item._source.duplicateACCount + item._source.employeeACCount + item._source.houseKeepingACCount ) : item._source.footfallCount - ( item._source.duplicateCount + item._source.employeeCount + item._source.houseKeepingCount ),
391
- 'Status': item._source.status,
392
391
  'Ticket%': item?._source?.status === 'closed'?`${Math.round( ( ( item._source.duplicateACCount + item._source.employeeACCount + item._source.houseKeepingACCount )/ item._source.footfallCount )*100 ).toFixed( 0 )} %` : `${Math.round( ( ( item?._source?.duplicateCount + item?._source?.employeeCount + item?._source?.houseKeepingCount )/ item?._source?.footfallCount )*100 ).toFixed( 0 )} %`,
392
+ 'Status': item._source.status,
393
393
  } );
394
394
  }
395
395
  return await download( exportData, res );
@@ -1642,6 +1642,15 @@ export async function infraTable( req, res ) {
1642
1642
  },
1643
1643
  );
1644
1644
  }
1645
+ if ( req.body.clusterStores&&req.body.clusterStores.length>0 ) {
1646
+ query.push(
1647
+ {
1648
+ $match: {
1649
+ 'basicDetails.storeId': { $in: req.body.clusterStores },
1650
+ },
1651
+ },
1652
+ );
1653
+ }
1645
1654
  query.push( {
1646
1655
  $match: {
1647
1656
  $and: [
@@ -2181,6 +2190,15 @@ export async function installationTable( req, res ) {
2181
2190
  );
2182
2191
  }
2183
2192
 
2193
+ if ( req.body.clusterStores&&req.body.clusterStores.length>0 ) {
2194
+ query.push(
2195
+ {
2196
+ $match: {
2197
+ 'basicDetails.storeId': { $in: req.body.clusterStores },
2198
+ },
2199
+ },
2200
+ );
2201
+ }
2184
2202
  query.push( {
2185
2203
  $match: {
2186
2204
  $and: [
@@ -2474,7 +2492,24 @@ export async function matTable( req, res ) {
2474
2492
  },
2475
2493
  } );
2476
2494
  }
2477
-
2495
+ if ( req.user && req.user.userType === 'client' && req.user.role != 'superadmin' ) {
2496
+ query.push(
2497
+ {
2498
+ $match: {
2499
+ 'basicDetails.storeId': { $in: req.body.assignedStores },
2500
+ },
2501
+ },
2502
+ );
2503
+ }
2504
+ if ( req.body.clusterStores&&req.body.clusterStores.length>0 ) {
2505
+ query.push(
2506
+ {
2507
+ $match: {
2508
+ 'basicDetails.storeId': { $in: req.body.clusterStores },
2509
+ },
2510
+ },
2511
+ );
2512
+ }
2478
2513
  query.push( {
2479
2514
  $match: {
2480
2515
  $and: [
@@ -2691,6 +2726,15 @@ export async function dataMismatchTable( req, res ) {
2691
2726
  );
2692
2727
  }
2693
2728
 
2729
+ if ( req.body.clusterStores&&req.body.clusterStores.length>0 ) {
2730
+ query.push(
2731
+ {
2732
+ $match: {
2733
+ 'basicDetails.storeId': { $in: req.body.clusterStores },
2734
+ },
2735
+ },
2736
+ );
2737
+ }
2694
2738
  if ( req.user.userType === 'client' ) {
2695
2739
  countFilter.push( { 'dataMismatch.showToClient': true } );
2696
2740
  }