tango-app-api-infra 3.1.8 → 3.1.9

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.8",
3
+ "version": "3.1.9",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -24,7 +24,7 @@
24
24
  "html-pdf-node": "^1.0.8",
25
25
  "mongodb": "^6.4.0",
26
26
  "nodemon": "^3.1.0",
27
- "tango-api-schema": "^2.0.92",
27
+ "tango-api-schema": "^2.0.94",
28
28
  "tango-app-api-middleware": "^3.1.7",
29
29
  "winston": "^3.12.0",
30
30
  "winston-daily-rotate-file": "^5.0.0"
@@ -10,7 +10,7 @@ import { getOpenSearchData } from 'tango-app-api-middleware';
10
10
  export async function infraCard( req, res ) {
11
11
  try {
12
12
  let date = await getUTC( new Date( req.body.fromDate ), new Date( req.body.toDate ) );
13
- let storeCount = await countDocumentsStore( { clientId: { $in: req.body.clientId }, status: 'active' } );
13
+ let storeCount = await countDocumentsStore( { clientId: { $in: req.body.clientId }, 'edge.firstFile': true,status:"active" } );
14
14
  let infraStoreCount = await aggregateTangoTicket( [
15
15
  {
16
16
  $match: {
@@ -148,8 +148,17 @@ export async function infraCard( req, res ) {
148
148
  }
149
149
  export async function installationCard( req, res ) {
150
150
  try {
151
- let onboardedCount = await countDocumentsStore( { clientId: { $in: req.body.clientId } } );
152
- let installedCount = await countDocumentsStore( { 'clientId': { $in: req.body.clientId }, 'edge.firstFile': true } );
151
+ let onboardedCount = await countDocumentsStore( {
152
+ '$and': [
153
+ { 'clientId': { $in: req.body.clientId } },
154
+ { $or: [
155
+ { 'edge.firstFile': true },
156
+ { 'edge.firstFile': false },
157
+ ] },
158
+ ],
159
+ } );
160
+ let installedCount = await countDocumentsStore( { 'clientId': { $in: req.body.clientId },
161
+ 'edge.firstFile': true,status:"active" } );
153
162
 
154
163
  let yettoInstallCount = await aggregateTangoTicket( [
155
164
  {
@@ -250,7 +259,7 @@ export async function installationCard( req, res ) {
250
259
  infraIssues: response,
251
260
  } );
252
261
  } catch ( error ) {
253
- logger.error( { error: error, function: 'infraCard' } );
262
+ logger.error( { error: error, function: 'installationCard' } );
254
263
  return res.sendError( error, 500 );
255
264
  }
256
265
  }
@@ -681,6 +690,7 @@ export async function hourWiseDownstores( req, res ) {
681
690
  let query = [ {
682
691
  $match: {
683
692
  clientId: req.body.clientId,
693
+ status: 'active',
684
694
  },
685
695
  },
686
696
  {
@@ -783,7 +793,7 @@ function downStoresCheck( data, inputData ) {
783
793
  const average = sum / streamwiseDowntime.length;
784
794
  obj[obj.startTime + '-' + obj.endTime] = Math.round( average );
785
795
  } else {
786
- obj[obj.startTime + '-' + obj.endTime] = 0;
796
+ obj[obj.startTime + '-' + obj.endTime] = '';
787
797
  }
788
798
 
789
799
  timewise.push( obj );
@@ -527,18 +527,17 @@ export async function infraReportSent( req, res ) {
527
527
  exportdata.push( {
528
528
  'Client ID': element.basicDetails.clientId,
529
529
  'Client Name': element.basicDetails.clientName,
530
- 'Created Date & Time': dayjs( element.createdAt ).format( 'YYYY-MM-DD HH:mm A' ),
531
- 'Store ID': element.basicDetails.clientName,
532
- 'Store Name': element.basicDetails.clientName,
530
+ 'Ticket Created Date & Time': dayjs( element.createdAt ).format( 'YYYY-MM-DD HH:mm A' ),
531
+ 'Store ID': element.basicDetails.storeId,
532
+ 'Store Name': element.basicDetails.storeName,
533
533
  'Issue ': element.primaryIssue,
534
534
  'Secondary Issue': element.secondaryIssue,
535
- 'Issue Date & Time': dayjs( element.date ).format( 'YYYY-MM-DD' ),
536
535
  'Status ': element.status,
537
536
  'Responded By': clientuser && clientuser.userName ? clientuser.userName : '-',
538
537
  'Resolved By': tangouser && tangouser.userName ? tangouser.userName : '-',
539
- 'Closed Date & Time': element.issueClosedDate ? dayjs( element.issueClosedDate ).format( 'YYYY-MM-DD HH:mm A' ) : '-',
538
+ 'Ticket Closed Date & Time': element.issueClosedDate ? dayjs( element.issueClosedDate ).format( 'YYYY-MM-DD HH:mm A' ) : '-',
540
539
  'Latest Comment': '',
541
- 'Activity Log': '',
540
+ 'Activity Log': `${appConfig.url.domain+'/manage/stores/infra-ticket?storeId='+element.basicDetails.storeId}`,
542
541
  } );
543
542
  }
544
543
 
@@ -611,7 +610,6 @@ export async function infraReportSent( req, res ) {
611
610
  const result = await sendEmailWithSES( req.body.email, subject, html, attachments, appConfig.cloud.aws.ses.adminEmail );
612
611
  res.sendSuccess( result );
613
612
  }
614
- res.sendSuccess( result );
615
613
  } catch ( error ) {
616
614
  logger.error( { error: error, function: 'infraReportSent' } );
617
615
  res.sendError( error, 500 );