tango-app-api-infra 3.0.101-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 +1 -1
- package/src/controllers/clientInfra.controller.js +2 -4
- package/src/controllers/infra.controllers.js +4 -2
- package/src/controllers/internalInfra.controller.js +2 -2
- package/src/controllers/storeInfra.controlller.js +168 -247
- package/src/controllers/userInfra.controller.js +4 -4
- package/src/validations/infra.validation.js +35 -35
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,
|
|
@@ -1154,7 +1152,7 @@ function downStoresCheck( data, inputData ) {
|
|
|
1154
1152
|
for ( const obj of TimeSlots ) {
|
|
1155
1153
|
obj.startTime = dayjs( obj.from ).format( 'hh:mm A' );
|
|
1156
1154
|
obj.endTime = dayjs( obj.to ).format( 'hh:mm A' );
|
|
1157
|
-
const downTime = await getOpenSearchData( '
|
|
1155
|
+
const downTime = await getOpenSearchData( 'live_downtime_hourly_test1',
|
|
1158
1156
|
{
|
|
1159
1157
|
'size': 1,
|
|
1160
1158
|
'query': {
|
|
@@ -58,7 +58,7 @@ export async function createTicket( req, res ) {
|
|
|
58
58
|
},
|
|
59
59
|
};
|
|
60
60
|
let downtimetotal;
|
|
61
|
-
const downtime = await getOpenSearchData( '
|
|
61
|
+
const downtime = await getOpenSearchData( 'live_downtime_hourly_test1', downTimeQuery );
|
|
62
62
|
let streamwiseDowntime = downtime.body.hits.hits.length > 0 ? downtime.body.hits.hits[0]._source.doc.streamwise_downtime : [];
|
|
63
63
|
if ( streamwiseDowntime.length > 0 ) {
|
|
64
64
|
const sum = streamwiseDowntime.reduce( ( accumulator, currentValue ) => {
|
|
@@ -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' } );
|
|
@@ -759,7 +761,7 @@ export async function getInfraIssues( req, res ) {
|
|
|
759
761
|
return res.sendError( 'NO Data Found', 204 );
|
|
760
762
|
}
|
|
761
763
|
for ( let i =0; i< mergeValue.length; i++ ) {
|
|
762
|
-
const downTime = await getOpenSearchData( '
|
|
764
|
+
const downTime = await getOpenSearchData( 'live_downtime_hourly_test1',
|
|
763
765
|
{
|
|
764
766
|
'size': 100,
|
|
765
767
|
'query': {
|
|
@@ -180,7 +180,7 @@ export async function updateRefreshTicket( req, res ) {
|
|
|
180
180
|
},
|
|
181
181
|
};
|
|
182
182
|
let downtimetotal;
|
|
183
|
-
const downtime = await getOpenSearchData( '
|
|
183
|
+
const downtime = await getOpenSearchData( 'live_downtime_hourly_test1', downTimeQuery );
|
|
184
184
|
let streamwiseDowntime = downtime.body.hits.hits.length > 0 ? downtime.body.hits.hits[0]._source.doc.streamwise_downtime : [];
|
|
185
185
|
if ( streamwiseDowntime.length > 0 ) {
|
|
186
186
|
const sum = streamwiseDowntime.reduce( ( accumulator, currentValue ) => {
|
|
@@ -261,7 +261,7 @@ export async function closeTicket( req, res ) {
|
|
|
261
261
|
},
|
|
262
262
|
};
|
|
263
263
|
let downtimetotal;
|
|
264
|
-
const downtime = await getOpenSearchData( '
|
|
264
|
+
const downtime = await getOpenSearchData( 'live_downtime_hourly_test1', downTimeQuery );
|
|
265
265
|
let streamwiseDowntime = downtime.body.hits.hits.length > 0 ? downtime.body.hits.hits[0]._source.doc.streamwise_downtime : [];
|
|
266
266
|
if ( streamwiseDowntime.length > 0 ) {
|
|
267
267
|
const sum = streamwiseDowntime.reduce( ( accumulator, currentValue ) => {
|
|
@@ -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
|
}
|
|
@@ -294,7 +294,6 @@ export async function edgeAppLogTable( req, res ) {
|
|
|
294
294
|
obj.startTime = dayjs( obj.from ).format( 'hh:mm A' );
|
|
295
295
|
obj.endTime = dayjs( obj.to ).format( 'hh:mm A' );
|
|
296
296
|
let internetSpeedQuery = {
|
|
297
|
-
'size': 1,
|
|
298
297
|
'query': {
|
|
299
298
|
'bool': {
|
|
300
299
|
'must': [
|
|
@@ -305,24 +304,20 @@ export async function edgeAppLogTable( req, res ) {
|
|
|
305
304
|
},
|
|
306
305
|
{
|
|
307
306
|
'term': {
|
|
308
|
-
'
|
|
307
|
+
'store_date.keyword': dayjs( obj.from ).format( 'DD-MM-YYYY' ),
|
|
309
308
|
},
|
|
310
309
|
},
|
|
311
310
|
{
|
|
312
|
-
'
|
|
313
|
-
'
|
|
311
|
+
'term': {
|
|
312
|
+
'storeId.keyword': req.body.storeId,
|
|
314
313
|
},
|
|
315
314
|
},
|
|
316
315
|
{
|
|
317
|
-
|
|
318
|
-
'
|
|
319
|
-
gte: obj.from,
|
|
320
|
-
lte: obj.to,
|
|
321
|
-
},
|
|
316
|
+
'term': {
|
|
317
|
+
'log_subtype.keyword': 'Speed_Test',
|
|
322
318
|
},
|
|
323
319
|
},
|
|
324
320
|
],
|
|
325
|
-
|
|
326
321
|
},
|
|
327
322
|
},
|
|
328
323
|
'sort': [
|
|
@@ -330,28 +325,41 @@ export async function edgeAppLogTable( req, res ) {
|
|
|
330
325
|
],
|
|
331
326
|
};
|
|
332
327
|
let speedTest = await getOpenSearchData( 'edgeapp_systemlogs', internetSpeedQuery );
|
|
333
|
-
if ( speedTest.body.hits && speedTest.body.hits.hits.length > 0
|
|
334
|
-
const
|
|
335
|
-
|
|
328
|
+
if ( speedTest&& speedTest.body.hits && speedTest.body.hits.hits.length > 0 ) {
|
|
329
|
+
for ( const sourcedata of speedTest.body.hits.hits ) {
|
|
330
|
+
if ( sourcedata._source ) {
|
|
331
|
+
if ( Number( sourcedata._source.data.occuringTime.split( ':' )[0] )==obj.hour ) {
|
|
332
|
+
const megabytes = bytesToMB( sourcedata._source.data.upload_Speed.split( '.' )[0] ).toFixed( 2 );
|
|
333
|
+
obj.Internetspeed = megabytes+ ' MB/sec';
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
336
337
|
} else {
|
|
337
338
|
obj.Internetspeed = '';
|
|
338
339
|
}
|
|
339
340
|
let FileCountQuery = {
|
|
341
|
+
'size': 1000,
|
|
340
342
|
'query': {
|
|
341
343
|
'bool': {
|
|
342
344
|
'must': [
|
|
343
|
-
|
|
344
345
|
{
|
|
345
346
|
'term': {
|
|
346
|
-
'
|
|
347
|
+
'log_type.keyword': 'Application',
|
|
347
348
|
},
|
|
348
349
|
},
|
|
349
350
|
{
|
|
350
|
-
|
|
351
|
-
'
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
351
|
+
'term': {
|
|
352
|
+
'store_date.keyword': dayjs( obj.from ).format( 'DD-MM-YYYY' ),
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
'term': {
|
|
357
|
+
'storeId.keyword': req.body.storeId,
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
'term': {
|
|
362
|
+
'log_subtype.keyword': 'Zip_File_Count',
|
|
355
363
|
},
|
|
356
364
|
},
|
|
357
365
|
],
|
|
@@ -363,13 +371,21 @@ export async function edgeAppLogTable( req, res ) {
|
|
|
363
371
|
{ 'timestamp': { 'order': 'desc' } },
|
|
364
372
|
],
|
|
365
373
|
};
|
|
366
|
-
let newFilesCount = await getOpenSearchData( '
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
374
|
+
let newFilesCount = await getOpenSearchData( 'edgeapp_systemlogs', FileCountQuery );
|
|
375
|
+
if ( newFilesCount&& newFilesCount.body.hits && newFilesCount.body.hits.hits.length > 0 ) {
|
|
376
|
+
obj.files_pushed = 0;
|
|
377
|
+
obj.files_generated = 0;
|
|
378
|
+
for ( let sourcedata of newFilesCount.body.hits.hits ) {
|
|
379
|
+
if ( sourcedata._source ) {
|
|
380
|
+
if ( Number( sourcedata._source.data.occuringTime.split( ':' )[0] )==obj.hour ) {
|
|
381
|
+
obj.files_pushed = obj.files_pushed+Number( sourcedata._source.data.files_pushed );
|
|
382
|
+
obj.files_genrated = obj.files_generated+Number( sourcedata._source.data.files_generated );
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
371
386
|
} else {
|
|
372
|
-
obj.
|
|
387
|
+
obj.files_pushed = '';
|
|
388
|
+
obj.files_generated = '';
|
|
373
389
|
}
|
|
374
390
|
let downTimeQuery = {
|
|
375
391
|
'size': 1,
|
|
@@ -396,7 +412,7 @@ export async function edgeAppLogTable( req, res ) {
|
|
|
396
412
|
},
|
|
397
413
|
},
|
|
398
414
|
};
|
|
399
|
-
const downtime = await getOpenSearchData( '
|
|
415
|
+
const downtime = await getOpenSearchData( 'live_downtime_hourly_test1', downTimeQuery );
|
|
400
416
|
let streamwiseDowntime = downtime.body.hits.hits.length > 0 ? downtime.body.hits.hits[0]._source.doc.streamwise_downtime : [];
|
|
401
417
|
if ( streamwiseDowntime.length > 0 ) {
|
|
402
418
|
const sum = streamwiseDowntime.reduce( ( accumulator, currentValue ) => {
|
|
@@ -407,47 +423,19 @@ export async function edgeAppLogTable( req, res ) {
|
|
|
407
423
|
} else {
|
|
408
424
|
obj.downtime = '';
|
|
409
425
|
}
|
|
410
|
-
let appStatusQuery = {
|
|
411
|
-
'size': 1,
|
|
412
|
-
'query': {
|
|
413
|
-
'bool': {
|
|
414
|
-
'must': [
|
|
415
|
-
{
|
|
416
|
-
'term': {
|
|
417
|
-
'log_type.keyword': 'Application',
|
|
418
|
-
},
|
|
419
|
-
},
|
|
420
|
-
{
|
|
421
|
-
'term': {
|
|
422
|
-
'storeId.keyword': req.body.storeId,
|
|
423
|
-
},
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
'terms': {
|
|
427
|
-
'log_subtype.keyword': [ 'Online_Status' ],
|
|
428
|
-
},
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
range: {
|
|
432
|
-
'timestamp': {
|
|
433
|
-
gte: obj.from,
|
|
434
|
-
lte: obj.to,
|
|
435
|
-
},
|
|
436
|
-
},
|
|
437
|
-
},
|
|
438
|
-
],
|
|
439
|
-
|
|
440
|
-
},
|
|
441
|
-
},
|
|
442
|
-
'sort': [
|
|
443
|
-
{ 'timestamp': { 'order': 'desc' } },
|
|
444
|
-
],
|
|
445
|
-
};
|
|
446
|
-
const appStatus = await getOpenSearchData( 'edgeapp_systemlogs', appStatusQuery );
|
|
447
|
-
obj.appStatus = appStatus.body.hits.hits.length > 0 ? appStatus.body.hits.hits[0]._source.data.message : '';
|
|
448
426
|
}
|
|
449
427
|
if ( req.body.export ) {
|
|
450
|
-
|
|
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 );
|
|
451
439
|
return;
|
|
452
440
|
}
|
|
453
441
|
res.sendSuccess( timeSlots );
|
|
@@ -485,6 +473,15 @@ function generateTimeSlots( startHour, endHour, interval, req ) {
|
|
|
485
473
|
}
|
|
486
474
|
};
|
|
487
475
|
|
|
476
|
+
function getTimeDifference( start, end ) {
|
|
477
|
+
let startTime = new Date( `1970-01-01T${start}Z` );
|
|
478
|
+
let endTime = new Date( `1970-01-01T${end}Z` );
|
|
479
|
+
let differenceInMilliseconds = endTime - startTime;
|
|
480
|
+
let differenceInSeconds = Math.floor( differenceInMilliseconds / 1000 );
|
|
481
|
+
let minutes = Math.floor( differenceInSeconds / 60 );
|
|
482
|
+
let seconds = differenceInSeconds % 60;
|
|
483
|
+
return { minutes, seconds };
|
|
484
|
+
}
|
|
488
485
|
|
|
489
486
|
export async function viewedgeAppLog( req, res ) {
|
|
490
487
|
try {
|
|
@@ -496,13 +493,10 @@ export async function viewedgeAppLog( req, res ) {
|
|
|
496
493
|
const fromTime = req.body.from;
|
|
497
494
|
const toTime = req.body.to;
|
|
498
495
|
let response = {};
|
|
499
|
-
const fromDateTime = dayjs( `${inputDate} ${fromTime}`, 'YYYY-MM-DD hh:mm A' );
|
|
500
|
-
const toDateTime = dayjs( `${inputDate} ${toTime}`, 'YYYY-MM-DD hh:mm A' );
|
|
501
496
|
|
|
502
|
-
|
|
503
|
-
const isoToDateTime = toDateTime.toISOString();
|
|
497
|
+
|
|
504
498
|
let appStartTimeQuery = {
|
|
505
|
-
'size':
|
|
499
|
+
'size': 1000,
|
|
506
500
|
'query': {
|
|
507
501
|
'bool': {
|
|
508
502
|
'must': [
|
|
@@ -513,30 +507,28 @@ export async function viewedgeAppLog( req, res ) {
|
|
|
513
507
|
},
|
|
514
508
|
{
|
|
515
509
|
'term': {
|
|
516
|
-
'
|
|
510
|
+
'store_date.keyword': dayjs( inputDate ).format( 'DD-MM-YYYY' ),
|
|
517
511
|
},
|
|
518
512
|
},
|
|
519
513
|
{
|
|
520
|
-
'
|
|
521
|
-
'
|
|
514
|
+
'term': {
|
|
515
|
+
'store_id.keyword': req.body.storeId,
|
|
522
516
|
},
|
|
523
517
|
},
|
|
524
518
|
{
|
|
525
|
-
|
|
526
|
-
'
|
|
527
|
-
gte: isoFromDateTime,
|
|
528
|
-
lte: isoToDateTime,
|
|
529
|
-
},
|
|
519
|
+
'term': {
|
|
520
|
+
'log_subtype.keyword': 'AppStart_Time',
|
|
530
521
|
},
|
|
531
522
|
},
|
|
532
523
|
],
|
|
533
524
|
|
|
534
525
|
},
|
|
535
526
|
},
|
|
536
|
-
|
|
537
527
|
};
|
|
538
528
|
const appStartTime = await getOpenSearchData( 'edgeapp_systemlogs', appStartTimeQuery );
|
|
539
529
|
|
|
530
|
+
response.appStartTime = appStartTime.body.hits.hits.length > 0 ? appStartTime.body.hits.hits[0]._source.data.occuringTime : '';
|
|
531
|
+
|
|
540
532
|
let appQuitTimeQuery = {
|
|
541
533
|
'size': 1,
|
|
542
534
|
'query': {
|
|
@@ -549,20 +541,17 @@ export async function viewedgeAppLog( req, res ) {
|
|
|
549
541
|
},
|
|
550
542
|
{
|
|
551
543
|
'term': {
|
|
552
|
-
'
|
|
544
|
+
'store_date.keyword': dayjs( inputDate ).format( 'DD-MM-YYYY' ),
|
|
553
545
|
},
|
|
554
546
|
},
|
|
555
547
|
{
|
|
556
|
-
'
|
|
557
|
-
'
|
|
548
|
+
'term': {
|
|
549
|
+
'store_id.keyword': req.body.storeId,
|
|
558
550
|
},
|
|
559
551
|
},
|
|
560
552
|
{
|
|
561
|
-
|
|
562
|
-
'
|
|
563
|
-
gte: isoFromDateTime,
|
|
564
|
-
lte: isoToDateTime,
|
|
565
|
-
},
|
|
553
|
+
'term': {
|
|
554
|
+
'log_subtype.keyword': 'App_Quit',
|
|
566
555
|
},
|
|
567
556
|
},
|
|
568
557
|
],
|
|
@@ -574,7 +563,13 @@ export async function viewedgeAppLog( req, res ) {
|
|
|
574
563
|
],
|
|
575
564
|
};
|
|
576
565
|
const appQuitTime = await getOpenSearchData( 'edgeapp_systemlogs', appQuitTimeQuery );
|
|
577
|
-
|
|
566
|
+
if ( appQuitTime.body.hits.hits&&appQuitTime.body.hits.hits.length > 0 ) {
|
|
567
|
+
for ( const sourceData of appQuitTime.body.hits.hits ) {
|
|
568
|
+
if ( Number( sourceData._source.data.occuringTime.split( ':' )[0] )== Number( fromTime.split( ':' )[0] ) ) {
|
|
569
|
+
response.appQuitTime = appQuitTime.body.hits.hits.length > 0 ? sourceData._source.data.occuringTime : '';
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
578
573
|
let appCrashTimeQuery = {
|
|
579
574
|
'size': 1,
|
|
580
575
|
'query': {
|
|
@@ -587,20 +582,17 @@ export async function viewedgeAppLog( req, res ) {
|
|
|
587
582
|
},
|
|
588
583
|
{
|
|
589
584
|
'term': {
|
|
590
|
-
'
|
|
585
|
+
'store_date.keyword': dayjs( inputDate ).format( 'DD-MM-YYYY' ),
|
|
591
586
|
},
|
|
592
587
|
},
|
|
593
588
|
{
|
|
594
|
-
'
|
|
595
|
-
'
|
|
589
|
+
'term': {
|
|
590
|
+
'store_id.keyword': req.body.storeId,
|
|
596
591
|
},
|
|
597
592
|
},
|
|
598
593
|
{
|
|
599
|
-
|
|
600
|
-
'
|
|
601
|
-
gte: isoFromDateTime,
|
|
602
|
-
lte: isoToDateTime,
|
|
603
|
-
},
|
|
594
|
+
'term': {
|
|
595
|
+
'log_subtype.keyword': 'App_Crash',
|
|
604
596
|
},
|
|
605
597
|
},
|
|
606
598
|
],
|
|
@@ -611,9 +603,17 @@ export async function viewedgeAppLog( req, res ) {
|
|
|
611
603
|
{ 'timestamp': { 'order': 'desc' } },
|
|
612
604
|
],
|
|
613
605
|
};
|
|
606
|
+
|
|
614
607
|
const appCrashTime = await getOpenSearchData( 'edgeapp_systemlogs', appCrashTimeQuery );
|
|
608
|
+
if ( appCrashTime.body.hits.hits&&appCrashTime.body.hits.hits.length > 0 ) {
|
|
609
|
+
for ( const sourceData of appCrashTime.body.hits.hits ) {
|
|
610
|
+
if ( Number( sourceData._source.data.occuringTime.split( ':' )[0] )== Number( fromTime.split( ':' )[0] ) ) {
|
|
611
|
+
response.AppCrashtime = appCrashTime.body.hits.hits.length > 0 ? sourceData._source.data.occuringTime : '';
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
615
|
const screenStatus = await getOpenSearchData( 'edgeapp_systemlogs', {
|
|
616
|
-
|
|
616
|
+
'size': 1000,
|
|
617
617
|
'query': {
|
|
618
618
|
'bool': {
|
|
619
619
|
'must': [
|
|
@@ -624,20 +624,17 @@ export async function viewedgeAppLog( req, res ) {
|
|
|
624
624
|
},
|
|
625
625
|
{
|
|
626
626
|
'term': {
|
|
627
|
-
'
|
|
627
|
+
'store_date.keyword': dayjs( inputDate ).format( 'DD-MM-YYYY' ),
|
|
628
628
|
},
|
|
629
629
|
},
|
|
630
630
|
{
|
|
631
|
-
'
|
|
632
|
-
'
|
|
631
|
+
'term': {
|
|
632
|
+
'store_id.keyword': req.body.storeId,
|
|
633
633
|
},
|
|
634
634
|
},
|
|
635
635
|
{
|
|
636
|
-
|
|
637
|
-
'
|
|
638
|
-
gte: isoFromDateTime,
|
|
639
|
-
lte: isoToDateTime,
|
|
640
|
-
},
|
|
636
|
+
'term': {
|
|
637
|
+
'log_subtype.keyword': 'System_Status',
|
|
641
638
|
},
|
|
642
639
|
},
|
|
643
640
|
],
|
|
@@ -645,12 +642,39 @@ export async function viewedgeAppLog( req, res ) {
|
|
|
645
642
|
},
|
|
646
643
|
},
|
|
647
644
|
'sort': [
|
|
648
|
-
{ 'timestamp': { 'order': '
|
|
645
|
+
{ 'timestamp': { 'order': 'asc' } },
|
|
649
646
|
],
|
|
650
647
|
|
|
651
648
|
} );
|
|
652
|
-
|
|
653
|
-
|
|
649
|
+
if ( screenStatus&& screenStatus.body.hits.hits&&screenStatus.body.hits.hits.length > 0 ) {
|
|
650
|
+
let suspendedTime;
|
|
651
|
+
let resumedTime;
|
|
652
|
+
const differences = [];
|
|
653
|
+
|
|
654
|
+
for ( const sourceData of screenStatus.body.hits.hits ) {
|
|
655
|
+
if ( Number( sourceData._source.data.occuringTime.split( ':' )[0] )== Number( fromTime.split( ':' )[0] ) ) {
|
|
656
|
+
if ( sourceData._source.data.message.trim() === 'SYSTEM SUSPENDED' ) {
|
|
657
|
+
suspendedTime = sourceData._source.data.occuringTime;
|
|
658
|
+
} else if ( sourceData._source.data.message.trim() === 'SYSTEM RESUMED' ) {
|
|
659
|
+
resumedTime = sourceData._source.data.occuringTime;
|
|
660
|
+
if ( suspendedTime ) {
|
|
661
|
+
const difference = getTimeDifference( suspendedTime, resumedTime );
|
|
662
|
+
differences.push( difference );
|
|
663
|
+
suspendedTime = null;
|
|
664
|
+
}
|
|
665
|
+
} else {
|
|
666
|
+
if ( suspendedTime ) {
|
|
667
|
+
const difference = getTimeDifference( suspendedTime, `${toTime}:00` );
|
|
668
|
+
differences.push( difference );
|
|
669
|
+
suspendedTime = null;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
response.screenStatus = differences.length>0?`${differences[0].minutes}Mins ${differences[0].seconds}Sec`:'';
|
|
675
|
+
}
|
|
676
|
+
const FileCountQuery = {
|
|
677
|
+
'size': 1000,
|
|
654
678
|
'query': {
|
|
655
679
|
'bool': {
|
|
656
680
|
'must': [
|
|
@@ -661,97 +685,45 @@ export async function viewedgeAppLog( req, res ) {
|
|
|
661
685
|
},
|
|
662
686
|
{
|
|
663
687
|
'term': {
|
|
664
|
-
'
|
|
688
|
+
'store_date.keyword': dayjs( inputDate ).format( 'DD-MM-YYYY' ),
|
|
665
689
|
},
|
|
666
690
|
},
|
|
667
691
|
{
|
|
668
|
-
'
|
|
669
|
-
'
|
|
692
|
+
'term': {
|
|
693
|
+
'storeId.keyword': req.body.storeId,
|
|
670
694
|
},
|
|
671
695
|
},
|
|
672
696
|
{
|
|
673
|
-
|
|
674
|
-
'
|
|
675
|
-
gte: isoFromDateTime,
|
|
676
|
-
lte: isoToDateTime,
|
|
677
|
-
},
|
|
697
|
+
'term': {
|
|
698
|
+
'log_subtype.keyword': 'Zip_File_Count',
|
|
678
699
|
},
|
|
679
700
|
},
|
|
680
701
|
],
|
|
681
702
|
|
|
682
703
|
},
|
|
683
704
|
},
|
|
705
|
+
|
|
684
706
|
'sort': [
|
|
685
707
|
{ 'timestamp': { 'order': 'desc' } },
|
|
686
708
|
],
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
lte: isoToDateTime,
|
|
705
|
-
},
|
|
706
|
-
},
|
|
707
|
-
},
|
|
708
|
-
],
|
|
709
|
-
|
|
710
|
-
},
|
|
711
|
-
},
|
|
712
|
-
|
|
713
|
-
'sort': [
|
|
714
|
-
{ 'timestamp': { 'order': 'desc' } },
|
|
715
|
-
],
|
|
716
|
-
} );
|
|
717
|
-
const speedTest = await getOpenSearchData( 'edgeapp_systemlogs',
|
|
718
|
-
{
|
|
719
|
-
'size': 1,
|
|
720
|
-
'query': {
|
|
721
|
-
'bool': {
|
|
722
|
-
'must': [
|
|
723
|
-
{
|
|
724
|
-
'term': {
|
|
725
|
-
'log_type.keyword': 'Application',
|
|
726
|
-
},
|
|
727
|
-
},
|
|
728
|
-
{
|
|
729
|
-
'term': {
|
|
730
|
-
'storeId.keyword': req.body.storeId,
|
|
731
|
-
},
|
|
732
|
-
},
|
|
733
|
-
{
|
|
734
|
-
'terms': {
|
|
735
|
-
'log_subtype.keyword': [ 'Speed_Test' ],
|
|
736
|
-
},
|
|
737
|
-
},
|
|
738
|
-
{
|
|
739
|
-
range: {
|
|
740
|
-
'timestamp': {
|
|
741
|
-
gte: isoFromDateTime,
|
|
742
|
-
lte: isoToDateTime,
|
|
743
|
-
},
|
|
744
|
-
},
|
|
745
|
-
},
|
|
746
|
-
],
|
|
709
|
+
};
|
|
710
|
+
const newFilesCount = await getOpenSearchData( 'edgeapp_systemlogs', FileCountQuery );
|
|
711
|
+
if ( newFilesCount&& newFilesCount.body.hits && newFilesCount.body.hits.hits.length > 0 ) {
|
|
712
|
+
response.filesPushed = 0;
|
|
713
|
+
response.files_genrated = 0;
|
|
714
|
+
for ( const sourcedata of newFilesCount.body.hits.hits ) {
|
|
715
|
+
if ( sourcedata._source ) {
|
|
716
|
+
if ( Number( sourcedata._source.data.occuringTime.split( ':' )[0] )==Number( fromTime.split( ':' )[0] ) ) {
|
|
717
|
+
response.filesPushed = response.filesPushed+Number( sourcedata._source.data.files_pushed );
|
|
718
|
+
response.files_genrated = response.files_generated+Number( sourcedata._source.data.files_generated );
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
} else {
|
|
723
|
+
response.filesPushed = '';
|
|
724
|
+
response.files_genrated = '';
|
|
725
|
+
}
|
|
747
726
|
|
|
748
|
-
},
|
|
749
|
-
},
|
|
750
|
-
'sort': [
|
|
751
|
-
{ 'timestamp': { 'order': 'desc' } },
|
|
752
|
-
],
|
|
753
|
-
},
|
|
754
|
-
);
|
|
755
727
|
|
|
756
728
|
const antiVirus = await getOpenSearchData( 'edgeapp_systemlogs', {
|
|
757
729
|
'size': 1,
|
|
@@ -769,16 +741,13 @@ export async function viewedgeAppLog( req, res ) {
|
|
|
769
741
|
},
|
|
770
742
|
},
|
|
771
743
|
{
|
|
772
|
-
'
|
|
773
|
-
'
|
|
744
|
+
'term': {
|
|
745
|
+
'store_date.keyword': dayjs( inputDate ).format( 'DD-MM-YYYY' ),
|
|
774
746
|
},
|
|
775
747
|
},
|
|
776
748
|
{
|
|
777
|
-
|
|
778
|
-
'
|
|
779
|
-
gte: isoFromDateTime,
|
|
780
|
-
lte: isoToDateTime,
|
|
781
|
-
},
|
|
749
|
+
'term': {
|
|
750
|
+
'log_subtype.keyword': 'Anti_Virus',
|
|
782
751
|
},
|
|
783
752
|
},
|
|
784
753
|
],
|
|
@@ -790,57 +759,9 @@ export async function viewedgeAppLog( req, res ) {
|
|
|
790
759
|
],
|
|
791
760
|
},
|
|
792
761
|
);
|
|
793
|
-
|
|
794
|
-
{
|
|
795
|
-
'size': 1,
|
|
796
|
-
'query': {
|
|
797
|
-
'bool': {
|
|
798
|
-
'must': [
|
|
799
|
-
{
|
|
800
|
-
'term': {
|
|
801
|
-
'doc.date.keyword': dayjs( req.body.Date ).format( 'DD-MM-YYYY' ),
|
|
802
|
-
},
|
|
803
|
-
},
|
|
804
|
-
{
|
|
805
|
-
'term': {
|
|
806
|
-
'doc.store_id.keyword': req.body.storeId,
|
|
807
|
-
},
|
|
808
|
-
},
|
|
809
|
-
{
|
|
810
|
-
'terms': {
|
|
811
|
-
'doc.hour.keyword': [ req.body.from.split( ':' )[0] ],
|
|
812
|
-
},
|
|
813
|
-
},
|
|
814
|
-
],
|
|
815
|
-
|
|
816
|
-
},
|
|
817
|
-
},
|
|
762
|
+
response.antiVirus = antiVirus.body.hits.hits.length > 0 && antiVirus.body.hits.hits[0]._source.data.message == 'st-launch-1.0.exe is deleted' ? antiVirus.body.hits.hits[0]._source.data.occuringTime : '';
|
|
818
763
|
|
|
819
|
-
} );
|
|
820
|
-
let streamwiseDowntime = downTime.body.hits.hits.length > 0 ? downTime.body.hits.hits[0]._source.doc.streamwise_downtime : [];
|
|
821
|
-
if ( streamwiseDowntime.length > 0 ) {
|
|
822
|
-
const sum = streamwiseDowntime.reduce( ( accumulator, currentValue ) => {
|
|
823
|
-
return accumulator + currentValue.down_time;
|
|
824
|
-
}, 0 );
|
|
825
764
|
|
|
826
|
-
// Calculate the average
|
|
827
|
-
const average = sum / streamwiseDowntime.length;
|
|
828
|
-
response.downTime = Math.round( average );
|
|
829
|
-
} else {
|
|
830
|
-
response.downTime = 0;
|
|
831
|
-
}
|
|
832
|
-
response.filesPushed = newFilesCount.body.hits.total.value;
|
|
833
|
-
if ( speedTest.body.hits && speedTest.body.hits.hits.length > 0 && speedTest.body.hits.hits[0]._source ) {
|
|
834
|
-
response.Internetspeed = speedTest.body.hits.hits[0]._source.data.upload_Speed;
|
|
835
|
-
} else {
|
|
836
|
-
response.Internetspeed = '';
|
|
837
|
-
}
|
|
838
|
-
response.antiVirus = antiVirus.body.hits.hits.length > 0 && antiVirus.body.hits.hits[0]._source.data.message == 'st-launch-1.0.exe is deleted' ? antiVirus.body.hits.hits[0]._source.data.occuringTime : '';
|
|
839
|
-
response.appStartTime = appStartTime.body.hits.hits.length > 0 ? appStartTime.body.hits.hits[0]._source.data.occuringTime : '';
|
|
840
|
-
response.appQuitTime = appQuitTime.body.hits.hits.length > 0 ? appQuitTime.body.hits.hits[0]._source.data.occuringTime : '';
|
|
841
|
-
response.AppCrashtime = appCrashTime.body.hits.hits.length > 0 ? appCrashTime.body.hits.hits[0]._source.data.occuringTime : '';
|
|
842
|
-
response.screenStatus = screenStatus.body.hits.hits.length > 0 ? screenStatus.body.hits.hits[0]._source.data.message : '';
|
|
843
|
-
response.appStatus = appStatus.body.hits.hits.length > 0 ? appStatus.body.hits.hits[0]._source.data.message : '';
|
|
844
765
|
res.sendSuccess( response );
|
|
845
766
|
} catch ( error ) {
|
|
846
767
|
logger.error( { error: error, function: 'viewedgeAppLog' } );
|
|
@@ -909,9 +830,9 @@ export async function cameraAngleChange( req, res ) {
|
|
|
909
830
|
}
|
|
910
831
|
}
|
|
911
832
|
function getDatesArray( fromDate, toDate ) {
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
833
|
+
const dates = [];
|
|
834
|
+
const currentDate = new Date( fromDate );
|
|
835
|
+
const endDate = new Date( toDate );
|
|
915
836
|
|
|
916
837
|
while ( currentDate <= endDate ) {
|
|
917
838
|
dates.push( currentDate.toISOString().split( 'T' )[0] ); // Convert Date to string format YYYY-MM-DD
|
|
@@ -994,7 +915,7 @@ export async function streamwiseDowntime( req, res ) {
|
|
|
994
915
|
},
|
|
995
916
|
},
|
|
996
917
|
};
|
|
997
|
-
const downtime = await getOpenSearchData( '
|
|
918
|
+
const downtime = await getOpenSearchData( 'live_downtime_hourly_test1', downTimeQuery );
|
|
998
919
|
|
|
999
920
|
let streamwiseDowntime = downtime.body.hits.hits.length > 0 ? downtime.body.hits.hits[0]._source.doc.streamwise_downtime : [];
|
|
1000
921
|
if ( streamwiseDowntime.length > 0 ) {
|
|
@@ -1051,7 +972,7 @@ export async function livecountCheck( inputData, req ) {
|
|
|
1051
972
|
},
|
|
1052
973
|
},
|
|
1053
974
|
};
|
|
1054
|
-
const downtime = await getOpenSearchData( '
|
|
975
|
+
const downtime = await getOpenSearchData( 'live_downtime_hourly_test1', downTimeQuery );
|
|
1055
976
|
let streamwiseDowntime = downtime.body.hits.hits.length > 0 ? downtime.body.hits.hits[0]._source.doc.streamwise_downtime : [];
|
|
1056
977
|
if ( streamwiseDowntime.length > 0 ) {
|
|
1057
978
|
const sum = streamwiseDowntime.reduce( ( accumulator, currentValue ) => {
|
|
@@ -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 ) {
|