tango-app-api-infra 3.0.102-dev → 3.0.103-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
|
@@ -573,9 +573,7 @@ export async function InstallationIssuesTable( req, res ) {
|
|
|
573
573
|
if ( req.body.installtionfilterIssue == 'installFailedStores' ) {
|
|
574
574
|
query.push( { $match: { 'ticketDetails.issueStatus': 'identified' } } );
|
|
575
575
|
}
|
|
576
|
-
|
|
577
|
-
query.push( { $match: { 'ticketDetails.issueStatus': 'notidentified' } } );
|
|
578
|
-
}
|
|
576
|
+
|
|
579
577
|
query.push( {
|
|
580
578
|
$project: {
|
|
581
579
|
createdAt: 1,
|
|
@@ -203,6 +203,8 @@ export async function secondaryReason( req, res ) {
|
|
|
203
203
|
count: list.length,
|
|
204
204
|
result: list,
|
|
205
205
|
} );
|
|
206
|
+
} else {
|
|
207
|
+
res.sendError( 'No data found', 204 );
|
|
206
208
|
}
|
|
207
209
|
} catch ( error ) {
|
|
208
210
|
logger.error( { error: error, function: 'secondaryReason' } );
|
|
@@ -137,10 +137,10 @@ export async function storeTicketList( req, res ) {
|
|
|
137
137
|
},
|
|
138
138
|
);
|
|
139
139
|
|
|
140
|
-
if ( req.body.filter &&
|
|
140
|
+
if ( req.body.filter &&req.body.filter.length>0 ) {
|
|
141
141
|
query.push( {
|
|
142
142
|
$match: {
|
|
143
|
-
primaryIssue: req.body.filter,
|
|
143
|
+
primaryIssue: { $in: req.body.filter },
|
|
144
144
|
},
|
|
145
145
|
} );
|
|
146
146
|
}
|
|
@@ -374,7 +374,7 @@ export async function edgeAppLogTable( req, res ) {
|
|
|
374
374
|
let newFilesCount = await getOpenSearchData( 'edgeapp_systemlogs', FileCountQuery );
|
|
375
375
|
if ( newFilesCount&& newFilesCount.body.hits && newFilesCount.body.hits.hits.length > 0 ) {
|
|
376
376
|
obj.files_pushed = 0;
|
|
377
|
-
obj.
|
|
377
|
+
obj.files_generated = 0;
|
|
378
378
|
for ( let sourcedata of newFilesCount.body.hits.hits ) {
|
|
379
379
|
if ( sourcedata._source ) {
|
|
380
380
|
if ( Number( sourcedata._source.data.occuringTime.split( ':' )[0] )==obj.hour ) {
|
|
@@ -385,9 +385,8 @@ export async function edgeAppLogTable( req, res ) {
|
|
|
385
385
|
}
|
|
386
386
|
} else {
|
|
387
387
|
obj.files_pushed = '';
|
|
388
|
-
obj.
|
|
388
|
+
obj.files_generated = '';
|
|
389
389
|
}
|
|
390
|
-
|
|
391
390
|
let downTimeQuery = {
|
|
392
391
|
'size': 1,
|
|
393
392
|
'query': {
|
|
@@ -426,7 +425,17 @@ export async function edgeAppLogTable( req, res ) {
|
|
|
426
425
|
}
|
|
427
426
|
}
|
|
428
427
|
if ( req.body.export ) {
|
|
429
|
-
|
|
428
|
+
const exportdata = [];
|
|
429
|
+
timeSlots.forEach( ( element ) => {
|
|
430
|
+
exportdata.push( {
|
|
431
|
+
'Time Stamp': element.startTime+ '-'+ element.endTime,
|
|
432
|
+
'Downtime': element.ticketId,
|
|
433
|
+
'Avg Internet Speed': element.Date,
|
|
434
|
+
'Files Genarated': element.issueClosedDate,
|
|
435
|
+
'Files Pushed': element.primaryIssue,
|
|
436
|
+
} );
|
|
437
|
+
} );
|
|
438
|
+
await download( exportdata, res );
|
|
430
439
|
return;
|
|
431
440
|
}
|
|
432
441
|
res.sendSuccess( timeSlots );
|
|
@@ -465,7 +474,6 @@ function generateTimeSlots( startHour, endHour, interval, req ) {
|
|
|
465
474
|
};
|
|
466
475
|
|
|
467
476
|
function getTimeDifference( start, end ) {
|
|
468
|
-
console.log( start, end );
|
|
469
477
|
let startTime = new Date( `1970-01-01T${start}Z` );
|
|
470
478
|
let endTime = new Date( `1970-01-01T${end}Z` );
|
|
471
479
|
let differenceInMilliseconds = endTime - startTime;
|
|
@@ -518,6 +526,7 @@ export async function viewedgeAppLog( req, res ) {
|
|
|
518
526
|
},
|
|
519
527
|
};
|
|
520
528
|
const appStartTime = await getOpenSearchData( 'edgeapp_systemlogs', appStartTimeQuery );
|
|
529
|
+
|
|
521
530
|
response.appStartTime = appStartTime.body.hits.hits.length > 0 ? appStartTime.body.hits.hits[0]._source.data.occuringTime : '';
|
|
522
531
|
|
|
523
532
|
let appQuitTimeQuery = {
|
|
@@ -638,13 +647,11 @@ export async function viewedgeAppLog( req, res ) {
|
|
|
638
647
|
|
|
639
648
|
} );
|
|
640
649
|
if ( screenStatus&& screenStatus.body.hits.hits&&screenStatus.body.hits.hits.length > 0 ) {
|
|
641
|
-
console.log( '==========', screenStatus.body.hits.hits.length );
|
|
642
650
|
let suspendedTime;
|
|
643
651
|
let resumedTime;
|
|
644
652
|
const differences = [];
|
|
645
653
|
|
|
646
654
|
for ( const sourceData of screenStatus.body.hits.hits ) {
|
|
647
|
-
console.log( sourceData._source.data.occuringTime );
|
|
648
655
|
if ( Number( sourceData._source.data.occuringTime.split( ':' )[0] )== Number( fromTime.split( ':' )[0] ) ) {
|
|
649
656
|
if ( sourceData._source.data.message.trim() === 'SYSTEM SUSPENDED' ) {
|
|
650
657
|
suspendedTime = sourceData._source.data.occuringTime;
|
|
@@ -664,7 +671,6 @@ export async function viewedgeAppLog( req, res ) {
|
|
|
664
671
|
}
|
|
665
672
|
}
|
|
666
673
|
}
|
|
667
|
-
console.log( differences );
|
|
668
674
|
response.screenStatus = differences.length>0?`${differences[0].minutes}Mins ${differences[0].seconds}Sec`:'';
|
|
669
675
|
}
|
|
670
676
|
const FileCountQuery = {
|
|
@@ -703,18 +709,18 @@ export async function viewedgeAppLog( req, res ) {
|
|
|
703
709
|
};
|
|
704
710
|
const newFilesCount = await getOpenSearchData( 'edgeapp_systemlogs', FileCountQuery );
|
|
705
711
|
if ( newFilesCount&& newFilesCount.body.hits && newFilesCount.body.hits.hits.length > 0 ) {
|
|
706
|
-
response.
|
|
712
|
+
response.filesPushed = 0;
|
|
707
713
|
response.files_genrated = 0;
|
|
708
714
|
for ( const sourcedata of newFilesCount.body.hits.hits ) {
|
|
709
715
|
if ( sourcedata._source ) {
|
|
710
|
-
if ( Number( sourcedata._source.data.occuringTime.split( ':' )[0] )==
|
|
711
|
-
response.
|
|
716
|
+
if ( Number( sourcedata._source.data.occuringTime.split( ':' )[0] )==Number( fromTime.split( ':' )[0] ) ) {
|
|
717
|
+
response.filesPushed = response.filesPushed+Number( sourcedata._source.data.files_pushed );
|
|
712
718
|
response.files_genrated = response.files_generated+Number( sourcedata._source.data.files_generated );
|
|
713
719
|
}
|
|
714
720
|
}
|
|
715
721
|
}
|
|
716
722
|
} else {
|
|
717
|
-
response.
|
|
723
|
+
response.filesPushed = '';
|
|
718
724
|
response.files_genrated = '';
|
|
719
725
|
}
|
|
720
726
|
|
|
@@ -234,13 +234,13 @@ export async function userTicketList( req, res ) {
|
|
|
234
234
|
},
|
|
235
235
|
} );
|
|
236
236
|
}
|
|
237
|
-
if ( req.body.filter && req.body.filter
|
|
237
|
+
if ( req.body.filter && req.body.filter.length>0 ) {
|
|
238
238
|
query.push( {
|
|
239
239
|
$match: {
|
|
240
240
|
$or: [
|
|
241
|
-
{ issueStatus: req.body.filter },
|
|
242
|
-
{ infraIssue: req.body.filter },
|
|
243
|
-
{ issueType: req.body.filter },
|
|
241
|
+
{ issueStatus: { $in: req.body.filter } },
|
|
242
|
+
{ infraIssue: { $in: req.body.filter } },
|
|
243
|
+
{ issueType: { $in: req.body.filter } },
|
|
244
244
|
],
|
|
245
245
|
},
|
|
246
246
|
} );
|
|
@@ -198,7 +198,7 @@ export async function ticketExists( req, res, next ) {
|
|
|
198
198
|
export async function validateTicketstatus( req, res, next ) {
|
|
199
199
|
try {
|
|
200
200
|
if ( req.body.issueType == 'infra' ) {
|
|
201
|
-
if ( req.body.secondary.length>0 ) {
|
|
201
|
+
if ( req.body.secondary&&req.body.secondary.length>0 ) {
|
|
202
202
|
if ( req.body.status == 'closed' ) {
|
|
203
203
|
return res.sendSuccess( 'Ticket already closed' );
|
|
204
204
|
}
|
|
@@ -269,28 +269,29 @@ export async function infraReasonExists( req, res, next ) {
|
|
|
269
269
|
} ],
|
|
270
270
|
},
|
|
271
271
|
);
|
|
272
|
-
} else {
|
|
273
|
-
if ( req.body.primary == 'Application Issues' ) {
|
|
274
|
-
let actionBy = '';
|
|
275
|
-
if ( req.user.userType == 'tango' ) {
|
|
276
|
-
actionBy = 'Tango';
|
|
277
|
-
} else if ( req.user.userType == 'client' ) {
|
|
278
|
-
actionBy = 'User';
|
|
279
|
-
}
|
|
280
|
-
req.body.ticketActivity.push( {
|
|
281
|
-
actionType: 'issueUpdate',
|
|
282
|
-
actionBy: actionBy,
|
|
283
|
-
timeStamp: new Date(),
|
|
284
|
-
IdentifiedBy: req.user.userName,
|
|
285
|
-
comment: req.body.comment,
|
|
286
|
-
reasons: [ {
|
|
287
|
-
primaryIssue: req.body.primary,
|
|
288
|
-
secondaryIssue: [],
|
|
289
|
-
} ],
|
|
290
|
-
},
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
272
|
}
|
|
273
|
+
// else {
|
|
274
|
+
// if ( req.body.primary == 'Application Issues' ) {
|
|
275
|
+
// let actionBy = '';
|
|
276
|
+
// if ( req.user.userType == 'tango' ) {
|
|
277
|
+
// actionBy = 'Tango';
|
|
278
|
+
// } else if ( req.user.userType == 'client' ) {
|
|
279
|
+
// actionBy = 'User';
|
|
280
|
+
// }
|
|
281
|
+
// req.body.ticketActivity.push( {
|
|
282
|
+
// actionType: 'issueUpdate',
|
|
283
|
+
// actionBy: actionBy,
|
|
284
|
+
// timeStamp: new Date(),
|
|
285
|
+
// IdentifiedBy: req.user.userName,
|
|
286
|
+
// comment: req.body.comment,
|
|
287
|
+
// reasons: [ {
|
|
288
|
+
// primaryIssue: req.body.primary,
|
|
289
|
+
// secondaryIssue: [],
|
|
290
|
+
// } ],
|
|
291
|
+
// },
|
|
292
|
+
// );
|
|
293
|
+
// }
|
|
294
|
+
// }
|
|
294
295
|
|
|
295
296
|
|
|
296
297
|
next();
|
|
@@ -313,20 +314,19 @@ export async function InfrastepstoResolve( req, res, next ) {
|
|
|
313
314
|
secondaryIsssue: [ ...secondaryReason.stepstoResolve ],
|
|
314
315
|
} );
|
|
315
316
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
} ) ),
|
|
317
|
+
|
|
318
|
+
req.body.ticketActivity.push( {
|
|
319
|
+
actionType: 'stepsToResolve',
|
|
320
|
+
actionBy: 'Tango',
|
|
321
|
+
timeStamp: new Date(),
|
|
322
|
+
IdentifiedBy: 'Tango',
|
|
323
|
+
reasons: steptoReslove.map( ( item ) => ( {
|
|
324
|
+
primaryIssue: item.primaryIssue,
|
|
325
|
+
secondaryIssue: item.secondaryIsssue.map( ( issue ) => ( {
|
|
326
|
+
name: issue.name, // Assuming each object has a 'name' property
|
|
327
327
|
} ) ),
|
|
328
|
-
} )
|
|
329
|
-
}
|
|
328
|
+
} ) ),
|
|
329
|
+
} );
|
|
330
330
|
}
|
|
331
331
|
next();
|
|
332
332
|
} catch ( error ) {
|