tango-app-api-infra 3.1.16 → 3.1.18
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 +426 -293
- package/src/controllers/dataMismatch.controller.js +13 -1
- package/src/controllers/infra.controllers.js +14 -3
- package/src/controllers/internalInfra.controller.js +4 -4
- package/src/controllers/storeInfra.controlller.js +351 -478
- package/src/controllers/userInfra.controller.js +29 -21
- package/src/validations/infra.validation.js +20 -21
|
@@ -24,7 +24,8 @@ export async function userTakeTicket( req, res ) {
|
|
|
24
24
|
if ( req.body.issueType == 'infra' ) {
|
|
25
25
|
let query = {
|
|
26
26
|
'status': { $ne: 'closed' },
|
|
27
|
-
'issueType': 'infra',
|
|
27
|
+
'issueType': 'infra',
|
|
28
|
+
'ticketDetails.assigntoUser': true,
|
|
28
29
|
'ticketDetails.addressingUser': { $exists: false },
|
|
29
30
|
'ticketDetails.issueStatus': 'notidentified',
|
|
30
31
|
'ticketDetails.addressingClient': { $exists: false },
|
|
@@ -37,11 +38,12 @@ export async function userTakeTicket( req, res ) {
|
|
|
37
38
|
if ( !userTicket ) {
|
|
38
39
|
let query = {
|
|
39
40
|
'status': { $ne: 'closed' },
|
|
40
|
-
'basicDetails.clientId': { $in: assignedClients },
|
|
41
41
|
'issueType': 'infra',
|
|
42
|
-
'ticketType': 'refreshticket',
|
|
42
|
+
'ticketDetails.ticketType': 'refreshticket',
|
|
43
43
|
'ticketDetails.refreshTicketStatus': 'notidentified',
|
|
44
44
|
};
|
|
45
|
+
console.log( query, assignedClients );
|
|
46
|
+
|
|
45
47
|
if ( assignedClients.length > 0 ) {
|
|
46
48
|
query = ( { ...query, ...{ 'basicDetails.clientId': { $in: assignedClients } } } );
|
|
47
49
|
}
|
|
@@ -130,22 +132,15 @@ export async function userTicketList( req, res ) {
|
|
|
130
132
|
},
|
|
131
133
|
} );
|
|
132
134
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
} else {
|
|
143
|
-
query.push( {
|
|
144
|
-
$match: {
|
|
145
|
-
updatedAt: { $gte: new Date( dayjs().format( 'YYYY-MM-DD' ) ) },
|
|
146
|
-
},
|
|
147
|
-
} );
|
|
148
|
-
}
|
|
135
|
+
|
|
136
|
+
query.push( {
|
|
137
|
+
$match: {
|
|
138
|
+
$and: [
|
|
139
|
+
{ updatedAt: { $gte: date.start } },
|
|
140
|
+
{ updatedAt: { $lte: date.end } },
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
} );
|
|
149
144
|
if ( req.body.status && req.body.status != '' ) {
|
|
150
145
|
query.push( {
|
|
151
146
|
$match: {
|
|
@@ -359,7 +354,6 @@ export async function workHistory( req, res ) {
|
|
|
359
354
|
$match: {
|
|
360
355
|
$and: [
|
|
361
356
|
{ 'basicDetails.clientId': { $in: req.body.clientId } },
|
|
362
|
-
{ 'status': 'closed' },
|
|
363
357
|
{ issueType: req.body.issueType },
|
|
364
358
|
{ 'ticketDetails.addressingUser': new mongoose.Types.ObjectId( req.body.userId ) },
|
|
365
359
|
],
|
|
@@ -370,7 +364,6 @@ export async function workHistory( req, res ) {
|
|
|
370
364
|
$match: {
|
|
371
365
|
$and: [
|
|
372
366
|
{ 'basicDetails.clientId': { $in: req.body.clientId } },
|
|
373
|
-
{ 'status': 'closed' },
|
|
374
367
|
{ issueType: { $in: [ 'highcount', 'lowcount' ] } },
|
|
375
368
|
{ 'ticketDetails.addressingUser': new mongoose.Types.ObjectId( req.body.userId ) },
|
|
376
369
|
],
|
|
@@ -427,6 +420,18 @@ export async function workHistory( req, res ) {
|
|
|
427
420
|
},
|
|
428
421
|
);
|
|
429
422
|
}
|
|
423
|
+
} else {
|
|
424
|
+
query.push(
|
|
425
|
+
{
|
|
426
|
+
$match: {
|
|
427
|
+
$and: [
|
|
428
|
+
{ createdAt: { $gte: date.start } },
|
|
429
|
+
{ createdAt: { $lte: date.end } },
|
|
430
|
+
],
|
|
431
|
+
|
|
432
|
+
},
|
|
433
|
+
},
|
|
434
|
+
);
|
|
430
435
|
}
|
|
431
436
|
|
|
432
437
|
if ( req.body.storeFilter && req.body.storeFilter.length > 0 ) {
|
|
@@ -544,6 +549,8 @@ export async function workHistory( req, res ) {
|
|
|
544
549
|
'Closed on': element.issueClosedDate,
|
|
545
550
|
'Issue Identified on': element.issueIdentifiedDate,
|
|
546
551
|
'Issue Type': element.infraIssue ? element.infraIssue : '-',
|
|
552
|
+
'Status': element.status,
|
|
553
|
+
|
|
547
554
|
};
|
|
548
555
|
}
|
|
549
556
|
if ( req.body.issueType === 'dataMismatch' ) {
|
|
@@ -557,6 +564,7 @@ export async function workHistory( req, res ) {
|
|
|
557
564
|
'Issue date': dayjs( element.issueDate ).format( 'DD MMM, YYYY' ),
|
|
558
565
|
'Closed on': element.issueClosedDate,
|
|
559
566
|
'Issue Type': element.issueType ? element.issueType : '-',
|
|
567
|
+
'Status': element.status,
|
|
560
568
|
};
|
|
561
569
|
}
|
|
562
570
|
exportdata.push( data );
|
|
@@ -29,19 +29,18 @@ export async function validateDetails( req, res, next ) {
|
|
|
29
29
|
clientName: client.clientName,
|
|
30
30
|
};
|
|
31
31
|
req.body.emailAlert = client.ticketConfigs.emailAlert;
|
|
32
|
-
if ( req.body.issueType == 'infra' ) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
32
|
+
// if ( req.body.issueType == 'infra' ) {
|
|
33
|
+
// let refreshdate = dayjs().add( client.ticketConfigs.refreshAlert, 'days' );
|
|
34
|
+
// req.body.ticketDetails = {
|
|
35
|
+
// ticketRefreshTime: new Date( dayjs( refreshdate ).format( 'YYYY-MM-DD' ) ),
|
|
36
|
+
// };
|
|
37
|
+
// }
|
|
38
|
+
if ( req.body.issueType == 'installation' ) {
|
|
38
39
|
let refreshdate = dayjs().add( client.ticketConfigs.installationReAssign, 'days' );
|
|
39
40
|
req.body.ticketDetails = {
|
|
40
41
|
ticketRefreshTime: new Date( dayjs( refreshdate ).format( 'YYYY-MM-DD' ) ),
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
44
|
next();
|
|
46
45
|
} catch ( error ) {
|
|
47
46
|
logger.error( { error: error, function: 'validateDetails' } );
|
|
@@ -56,24 +55,24 @@ export async function validateTicket( req, res, next ) {
|
|
|
56
55
|
{
|
|
57
56
|
'basicDetails.storeId': req.body.basicDetails.storeId,
|
|
58
57
|
'issueType': 'infra',
|
|
59
|
-
'
|
|
58
|
+
'status': { $ne: 'closed' },
|
|
60
59
|
},
|
|
61
60
|
);
|
|
62
61
|
if ( Ticket ) {
|
|
63
|
-
return res.sendSuccess( 'Infra Ticket Already Exists
|
|
62
|
+
return res.sendSuccess( 'Infra Ticket Already Exists' );
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
let refreshTicket = await findOneTangoTicket(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
);
|
|
74
|
-
if ( refreshTicket ) {
|
|
75
|
-
|
|
76
|
-
}
|
|
65
|
+
// let refreshTicket = await findOneTangoTicket(
|
|
66
|
+
// {
|
|
67
|
+
// 'basicDetails.storeId': req.body.basicDetails.storeId,
|
|
68
|
+
// 'issueType': 'infra',
|
|
69
|
+
// 'status': { $ne: 'closed' },
|
|
70
|
+
// 'ticketDetails.ticketRefreshTime': { $lte: new Date() },
|
|
71
|
+
// },
|
|
72
|
+
// );
|
|
73
|
+
// if ( refreshTicket ) {
|
|
74
|
+
// return res.sendSuccess( 'refreshTicket Ticket Already Exists for the Store' );
|
|
75
|
+
// }
|
|
77
76
|
} else if ( req.body.issueType == 'installation' ) {
|
|
78
77
|
let Ticket = await findOneTangoTicket(
|
|
79
78
|
{
|