tango-app-api-infra 3.0.77-dev → 3.0.79-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.
|
|
3
|
+
"version": "3.0.79-dev",
|
|
4
4
|
"description": "infra",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"mongodb": "^6.4.0",
|
|
27
27
|
"nodemon": "^3.1.0",
|
|
28
28
|
"swagger-ui-express": "^5.0.0",
|
|
29
|
-
"tango-api-schema": "^2.0.
|
|
30
|
-
"tango-app-api-middleware": "^1.0.
|
|
29
|
+
"tango-api-schema": "^2.0.103",
|
|
30
|
+
"tango-app-api-middleware": "^1.0.70-test",
|
|
31
31
|
"winston": "^3.12.0",
|
|
32
32
|
"winston-daily-rotate-file": "^5.0.0"
|
|
33
33
|
},
|
|
@@ -48,3 +48,16 @@ export async function activityLog( req, res ) {
|
|
|
48
48
|
return res.sendError( error, 500 );
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
export async function updateMatStatus( req, res ) {
|
|
54
|
+
try {
|
|
55
|
+
let update = await updateOneTangoTicket( { ticketId: req.body.ticketId }, { 'ticketDetails.matStatus': req.body.matStatus } );
|
|
56
|
+
if ( update ) {
|
|
57
|
+
res.sendSuccess( 'Updated Successfully' );
|
|
58
|
+
}
|
|
59
|
+
} catch ( error ) {
|
|
60
|
+
logger.error( { error: error, function: 'updateMatStatus' } );
|
|
61
|
+
return res.sendError( error, 500 );
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -1444,14 +1444,14 @@ export async function matTable( req, res ) {
|
|
|
1444
1444
|
result.forEach( ( element ) => {
|
|
1445
1445
|
exportdata.push( {
|
|
1446
1446
|
'ticketId': element.ticketId,
|
|
1447
|
-
'
|
|
1447
|
+
'Date': dayjs( element.issueDate ).format( 'DD-MM-YYYY' ),
|
|
1448
1448
|
'storeId': element.storeId,
|
|
1449
1449
|
'storeName': element.storeName,
|
|
1450
1450
|
'clientId': element.clientId,
|
|
1451
1451
|
'clientName': element.clientName,
|
|
1452
1452
|
'userName': element.userName,
|
|
1453
1453
|
'userEmail': element.userEmail,
|
|
1454
|
-
'Status': element.
|
|
1454
|
+
'Status': element.status,
|
|
1455
1455
|
} );
|
|
1456
1456
|
} );
|
|
1457
1457
|
await download( exportdata, res );
|
|
@@ -165,6 +165,7 @@ export async function userTicketList( req, res ) {
|
|
|
165
165
|
issueStatus: '$ticketDetails.issueStatus',
|
|
166
166
|
ticketType: '$ticketDetails.ticketType',
|
|
167
167
|
installationStatus: '$ticketDetails.installationStatus',
|
|
168
|
+
matStatus: '$ticketDetails.matStatus',
|
|
168
169
|
primaryIssue: {
|
|
169
170
|
$filter: {
|
|
170
171
|
input: '$ticketActivity',
|
|
@@ -196,6 +197,7 @@ export async function userTicketList( req, res ) {
|
|
|
196
197
|
status: 1,
|
|
197
198
|
issueType: 1,
|
|
198
199
|
installationStatus: 1,
|
|
200
|
+
matStatus: 1,
|
|
199
201
|
infraIssue: '$primaryIssue.reasons.primaryIssue',
|
|
200
202
|
},
|
|
201
203
|
},
|
|
@@ -210,6 +212,7 @@ export async function userTicketList( req, res ) {
|
|
|
210
212
|
issueType: { $first: '$issueType' },
|
|
211
213
|
status: { $first: '$status' },
|
|
212
214
|
installationStatus: { $first: '$installationStatus' },
|
|
215
|
+
matStatus: { $first: '$matStatus' },
|
|
213
216
|
issueStatus: { $first: '$issueStatus' },
|
|
214
217
|
ticketType: { $first: '$ticketType' },
|
|
215
218
|
infraIssue: { $last: '$infraIssue' },
|
|
@@ -234,6 +237,7 @@ export async function userTicketList( req, res ) {
|
|
|
234
237
|
$or: [
|
|
235
238
|
{ issueStatus: req.body.filter },
|
|
236
239
|
{ infraIssue: req.body.filter },
|
|
240
|
+
{ issueType: req.body.filter },
|
|
237
241
|
],
|
|
238
242
|
},
|
|
239
243
|
} );
|
|
@@ -242,13 +246,23 @@ export async function userTicketList( req, res ) {
|
|
|
242
246
|
if ( req.body.export ) {
|
|
243
247
|
const exportdata = [];
|
|
244
248
|
ticketList.forEach( ( element ) => {
|
|
245
|
-
|
|
249
|
+
let data = {
|
|
246
250
|
'DATE': element.Date,
|
|
247
251
|
'TICKET ID': element.ticketId,
|
|
248
252
|
'STORE ID': element.storeId,
|
|
249
|
-
'
|
|
253
|
+
'STORE NAME': element.storeName,
|
|
250
254
|
'STATUS': element.status,
|
|
251
|
-
}
|
|
255
|
+
};
|
|
256
|
+
if ( req.body.issueType ==='infra' ) {
|
|
257
|
+
data = { ...data, ...{ 'ISSUE': element.issueStatus } };
|
|
258
|
+
}
|
|
259
|
+
if ( req.body.issueType ==='installation' ) {
|
|
260
|
+
data = { ...data, ...{ 'ISSUE': element.issueStatus } };
|
|
261
|
+
}
|
|
262
|
+
if ( req.body.issueType ==='dataMismatch' ) {
|
|
263
|
+
data = { ...data, ...{ 'ISSUE TYPE': element.issueType } };
|
|
264
|
+
}
|
|
265
|
+
exportdata.push( data );
|
|
252
266
|
} );
|
|
253
267
|
await download( exportdata, res );
|
|
254
268
|
return;
|
|
@@ -377,6 +391,18 @@ export async function workHistory( req, res ) {
|
|
|
377
391
|
{ 'issueClosedDate': { $lte: date.end } },
|
|
378
392
|
],
|
|
379
393
|
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
);
|
|
397
|
+
} else if ( req.body.dateFilter === 'issueDate' ) {
|
|
398
|
+
query.push(
|
|
399
|
+
{
|
|
400
|
+
$match: {
|
|
401
|
+
$and: [
|
|
402
|
+
{ 'issueDate': { $gte: date.start } },
|
|
403
|
+
{ 'issueDate': { $lte: date.end } },
|
|
404
|
+
],
|
|
405
|
+
|
|
380
406
|
},
|
|
381
407
|
},
|
|
382
408
|
);
|
|
@@ -411,6 +437,7 @@ export async function workHistory( req, res ) {
|
|
|
411
437
|
storeName: '$basicDetails.storeName',
|
|
412
438
|
clientId: '$basicDetails.clientId',
|
|
413
439
|
clientName: '$basicDetails.clientName',
|
|
440
|
+
issueType: 1,
|
|
414
441
|
issueDate: { $dateToString: { format: '%Y-%m-%d', date: '$createdAt' } },
|
|
415
442
|
issueClosedDate: { $dateToString: { format: '%Y-%m-%d', date: '$issueClosedDate' } },
|
|
416
443
|
issueIdentifiedDate: { $dateToString: { format: '%Y-%m-%d', date: '$ticketDetails.issueIdentifiedDate' } },
|
|
@@ -440,6 +467,7 @@ export async function workHistory( req, res ) {
|
|
|
440
467
|
$project: {
|
|
441
468
|
storeId: 1,
|
|
442
469
|
storeName: 1,
|
|
470
|
+
issueType: 1,
|
|
443
471
|
clientId: 1,
|
|
444
472
|
clientName: 1,
|
|
445
473
|
issueDate: 1,
|
|
@@ -452,13 +480,20 @@ export async function workHistory( req, res ) {
|
|
|
452
480
|
infraIssue: { $ifNull: [ '$primaryIssue.reasons.primaryIssue', '' ] },
|
|
453
481
|
},
|
|
454
482
|
} );
|
|
455
|
-
if ( req.body.issueFilter && req.body.issueFilter.length>0 ) {
|
|
483
|
+
if ( req.body.issueFilter && req.body.issueFilter.length>0&&req.body.issueType!='dataMismatch' ) {
|
|
456
484
|
query.push( {
|
|
457
485
|
$match: {
|
|
458
486
|
infraIssue: { $in: req.body.issueFilter },
|
|
459
487
|
},
|
|
460
488
|
} );
|
|
461
489
|
}
|
|
490
|
+
if ( req.body.issueFilter && req.body.issueFilter.length>0&&req.body.issueType==='dataMismatch' ) {
|
|
491
|
+
query.push( {
|
|
492
|
+
$match: {
|
|
493
|
+
issueType: { $in: req.body.issueFilter },
|
|
494
|
+
},
|
|
495
|
+
} );
|
|
496
|
+
}
|
|
462
497
|
if ( req.body.searchValue && req.body.searchValue !== '' ) {
|
|
463
498
|
query.push( {
|
|
464
499
|
$match: {
|
|
@@ -489,19 +524,24 @@ export async function workHistory( req, res ) {
|
|
|
489
524
|
if ( req.body.export ) {
|
|
490
525
|
const exportdata = [];
|
|
491
526
|
result.forEach( ( element ) => {
|
|
492
|
-
|
|
527
|
+
let data ={
|
|
493
528
|
'CREATED ON': dayjs( element.issueDate ).format( 'DD-MM-YYYY' ),
|
|
494
529
|
'TICKET ID': element.ticketId,
|
|
495
530
|
'STORE ID': element.storeId,
|
|
496
531
|
'STORE NAME': element.storeName,
|
|
497
532
|
'CLIENT ID': element.clientId,
|
|
498
533
|
'CLIENT NAME': element.clientName,
|
|
499
|
-
'ISSUE IDENTIFIED DATE': element.issueIdentifiedDate,
|
|
500
534
|
'CLOSED ON': element.issueClosedDate,
|
|
501
|
-
'ISSUE': element.infraIssue?element.infraIssue:'-',
|
|
502
535
|
'STATUS': element.status,
|
|
503
|
-
}
|
|
536
|
+
};
|
|
537
|
+
exportdata.push( data );
|
|
504
538
|
} );
|
|
539
|
+
if ( req.body.issueType==='infra'||req.body.issueType==='installation' ) {
|
|
540
|
+
data = { ...data, ...{ 'ISSUE': element.infraIssue?element.infraIssue:'-', 'ISSUE IDENTIFIED DATE': element.issueIdentifiedDate } };
|
|
541
|
+
}
|
|
542
|
+
if ( req.body.issueType==='dataMismatch' ) {
|
|
543
|
+
data = { ...data, ...{ 'issueType': element.issueType?element.issueType:'-' } };
|
|
544
|
+
}
|
|
505
545
|
await download( exportdata, res );
|
|
506
546
|
return;
|
|
507
547
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createTicket, updatecomment, activityLog } from '../controllers/employeeTraning.controller.js';
|
|
1
|
+
import { createTicket, updatecomment, activityLog, updateMatStatus } from '../controllers/employeeTraning.controller.js';
|
|
2
2
|
import { ticketExists, validateDetails } from '../validations/infra.validation.js';
|
|
3
3
|
import express from 'express';
|
|
4
4
|
import { isAllowedSessionHandler, authorize } from 'tango-app-api-middleware';
|
|
@@ -15,3 +15,7 @@ employeeTrainigRouter.post( '/activityLog', isAllowedSessionHandler, authorize(
|
|
|
15
15
|
userType: [ 'tango' ], access: [
|
|
16
16
|
{ featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
|
|
17
17
|
} ), ticketExists, activityLog );
|
|
18
|
+
employeeTrainigRouter.post( '/updateMatStatus', isAllowedSessionHandler, authorize( {
|
|
19
|
+
userType: [ 'tango' ], access: [
|
|
20
|
+
{ featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
|
|
21
|
+
} ), ticketExists, updateMatStatus );
|
|
@@ -186,7 +186,7 @@ export async function ticketExists( req, res, next ) {
|
|
|
186
186
|
req.body.ticketActivity = Ticket.ticketActivity;
|
|
187
187
|
req.body.status = Ticket.status;
|
|
188
188
|
req.body.issueDate = Ticket.issueDate;
|
|
189
|
-
|
|
189
|
+
req.body.dataMismatch = Ticket.dataMismatch;
|
|
190
190
|
|
|
191
191
|
next();
|
|
192
192
|
} catch ( error ) {
|