tango-app-api-infra 3.0.59-dev → 3.0.61-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/index.js +3 -1
- package/package.json +3 -3
- package/src/controllers/clientInfra.controller.js +14 -6
- package/src/controllers/dataMismatch.controller.js +23 -0
- package/src/controllers/employeeTraning.controller.js +0 -4
- package/src/controllers/infra.controllers.js +22 -19
- package/src/controllers/internalInfra.controller.js +5 -7
- package/src/controllers/userInfra.controller.js +59 -21
- package/src/routes/dataMismatch.routes.js +10 -0
- package/src/routes/infra.routes.js +2 -2
- package/src/validations/infra.validation.js +35 -0
package/index.js
CHANGED
|
@@ -6,7 +6,9 @@ import { userInfraRouter } from './src/routes/userInfra.routes.js';
|
|
|
6
6
|
import { storeInfraRouter } from './src/routes/storeInfra.routes.js';
|
|
7
7
|
import { clientInfraRouter } from './src/routes/clientInfra.routes.js';
|
|
8
8
|
import { employeeTrainigRouter } from './src/routes/employeetrainig.routes.js';
|
|
9
|
+
import { dataMismatchRouter } from './src/routes/dataMismatch.routes.js';
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
export { infraRouter, internalInfraRouter, userInfraRouter, storeInfraRouter, dataMismatchRouter, clientInfraRouter, employeeTrainigRouter };
|
|
11
13
|
|
|
12
14
|
|
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.61-dev",
|
|
4
4
|
"description": "infra",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -24,8 +24,8 @@
|
|
|
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.
|
|
28
|
-
"tango-app-api-middleware": "^1.0.
|
|
27
|
+
"tango-api-schema": "^2.0.94",
|
|
28
|
+
"tango-app-api-middleware": "^1.0.58-dev",
|
|
29
29
|
"winston": "^3.12.0",
|
|
30
30
|
"winston-daily-rotate-file": "^5.0.0"
|
|
31
31
|
},
|
|
@@ -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: {
|
|
@@ -46,13 +46,14 @@ export async function infraCard( req, res ) {
|
|
|
46
46
|
},
|
|
47
47
|
},
|
|
48
48
|
] );
|
|
49
|
+
|
|
49
50
|
let query = [ {
|
|
50
51
|
$match: {
|
|
51
52
|
$and: [
|
|
52
53
|
{ issueType: 'infra' },
|
|
54
|
+
{ status: { $ne: 'closed' } },
|
|
53
55
|
{ 'ticketDetails.issueStatus': 'identified' },
|
|
54
56
|
{ 'basicDetails.clientId': { $in: req.body.clientId } },
|
|
55
|
-
{ 'ticketDetails.issueStatus': 'identified' },
|
|
56
57
|
{ createdAt: { $gte: date.start } },
|
|
57
58
|
{ createdAt: { $lte: date.end } },
|
|
58
59
|
],
|
|
@@ -148,8 +149,13 @@ export async function infraCard( req, res ) {
|
|
|
148
149
|
}
|
|
149
150
|
export async function installationCard( req, res ) {
|
|
150
151
|
try {
|
|
151
|
-
let onboardedCount = await countDocumentsStore( {
|
|
152
|
-
|
|
152
|
+
let onboardedCount = await countDocumentsStore( {
|
|
153
|
+
'$and': [
|
|
154
|
+
{ 'clientId': { $in: req.body.clientId } },
|
|
155
|
+
],
|
|
156
|
+
} );
|
|
157
|
+
let installedCount = await countDocumentsStore( { 'clientId': { $in: req.body.clientId },
|
|
158
|
+
'edge.firstFile': true, 'status': 'active' } );
|
|
153
159
|
|
|
154
160
|
let yettoInstallCount = await aggregateTangoTicket( [
|
|
155
161
|
{
|
|
@@ -250,7 +256,7 @@ export async function installationCard( req, res ) {
|
|
|
250
256
|
infraIssues: response,
|
|
251
257
|
} );
|
|
252
258
|
} catch ( error ) {
|
|
253
|
-
logger.error( { error: error, function: '
|
|
259
|
+
logger.error( { error: error, function: 'installationCard' } );
|
|
254
260
|
return res.sendError( error, 500 );
|
|
255
261
|
}
|
|
256
262
|
}
|
|
@@ -261,6 +267,7 @@ export async function infraIssuesTable( req, res ) {
|
|
|
261
267
|
$match: {
|
|
262
268
|
$and: [
|
|
263
269
|
{ issueType: 'infra' },
|
|
270
|
+
{ status: { $ne: 'closed' } },
|
|
264
271
|
{ 'basicDetails.clientId': { $in: req.body.clientId } },
|
|
265
272
|
{ 'ticketDetails.issueStatus': 'identified' },
|
|
266
273
|
{ createdAt: { $gte: date.start } },
|
|
@@ -681,6 +688,7 @@ export async function hourWiseDownstores( req, res ) {
|
|
|
681
688
|
let query = [ {
|
|
682
689
|
$match: {
|
|
683
690
|
clientId: req.body.clientId,
|
|
691
|
+
status: 'active',
|
|
684
692
|
},
|
|
685
693
|
},
|
|
686
694
|
{
|
|
@@ -783,7 +791,7 @@ function downStoresCheck( data, inputData ) {
|
|
|
783
791
|
const average = sum / streamwiseDowntime.length;
|
|
784
792
|
obj[obj.startTime + '-' + obj.endTime] = Math.round( average );
|
|
785
793
|
} else {
|
|
786
|
-
obj[obj.startTime + '-' + obj.endTime] =
|
|
794
|
+
obj[obj.startTime + '-' + obj.endTime] = '';
|
|
787
795
|
}
|
|
788
796
|
|
|
789
797
|
timewise.push( obj );
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
import { findOneTangoTicket, createTangoTicket } from '../services/tangoTicket.service.js';
|
|
3
|
+
import { logger } from 'tango-app-api-middleware';
|
|
4
|
+
export async function createTicket( req, res ) {
|
|
5
|
+
try {
|
|
6
|
+
let ticketExist = await findOneTangoTicket( { 'issueType': req.body.issueType, 'issueDate': ( new Date( req.body.Date ) ), 'basicDetails.storeId': req.body.storeId } );
|
|
7
|
+
|
|
8
|
+
if ( ticketExist ) {
|
|
9
|
+
return res.sendSuccess( 'MAT Ticket Already Exists for the store' );
|
|
10
|
+
}
|
|
11
|
+
req.body.ticketDetails = {};
|
|
12
|
+
req.body.ticketDetails.dataMismatch = req.body.dataMismatch;
|
|
13
|
+
req.body.issueDate = new Date( req.body.Date );
|
|
14
|
+
req.body.ticketId = 'TE_DM_' + new Date().valueOf();
|
|
15
|
+
let create = await createTangoTicket( req.body );
|
|
16
|
+
if ( create ) {
|
|
17
|
+
res.sendSuccess( 'Ticket Created Successfully' );
|
|
18
|
+
}
|
|
19
|
+
} catch ( error ) {
|
|
20
|
+
logger.error( { error: error, function: 'createTicket Data Mismatch' } );
|
|
21
|
+
return res.sendError( error, 500 );
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { createTangoTicket, findOneTangoTicket, updateOneTangoTicket } from '../services/tangoTicket.service.js';
|
|
3
3
|
import { logger } from 'tango-app-api-middleware';
|
|
4
4
|
export async function createTicket( req, res ) {
|
|
5
|
-
console.log( req.body );
|
|
6
5
|
try {
|
|
7
6
|
let ticketExist = await findOneTangoTicket( { 'issueType': req.body.issueType, 'basicDetails.storeId': req.body.storeId } );
|
|
8
7
|
if ( ticketExist ) {
|
|
@@ -12,7 +11,6 @@ export async function createTicket( req, res ) {
|
|
|
12
11
|
req.body.issueDate = new Date( req.body.Date );
|
|
13
12
|
req.body.ticketId = 'TE_MAT_' + new Date().valueOf();
|
|
14
13
|
let create = await createTangoTicket( req.body );
|
|
15
|
-
console.log( create );
|
|
16
14
|
if ( create ) {
|
|
17
15
|
res.sendSuccess( 'Ticket Created Successfully' );
|
|
18
16
|
}
|
|
@@ -23,7 +21,6 @@ export async function createTicket( req, res ) {
|
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
export async function updatecomment( req, res ) {
|
|
26
|
-
console.log( req.body );
|
|
27
24
|
try {
|
|
28
25
|
if ( req.body.comment != '' ) {
|
|
29
26
|
req.body.ticketActivity.push( {
|
|
@@ -44,7 +41,6 @@ export async function updatecomment( req, res ) {
|
|
|
44
41
|
}
|
|
45
42
|
}
|
|
46
43
|
export async function activityLog( req, res ) {
|
|
47
|
-
console.log( req.body );
|
|
48
44
|
try {
|
|
49
45
|
res.sendSuccess( req.body );
|
|
50
46
|
} catch ( error ) {
|
|
@@ -642,7 +642,8 @@ export async function infraTable( req, res ) {
|
|
|
642
642
|
{ createdAt: { $lte: date.end } },
|
|
643
643
|
],
|
|
644
644
|
},
|
|
645
|
-
},
|
|
645
|
+
},
|
|
646
|
+
{
|
|
646
647
|
$project: {
|
|
647
648
|
storeId: '$basicDetails.storeId',
|
|
648
649
|
clientId: '$basicDetails.clientId',
|
|
@@ -739,6 +740,11 @@ export async function infraTable( req, res ) {
|
|
|
739
740
|
secondaryIssue: { $last: '$secondaryIssue' },
|
|
740
741
|
},
|
|
741
742
|
},
|
|
743
|
+
{
|
|
744
|
+
$sort: {
|
|
745
|
+
ticketId: -1,
|
|
746
|
+
},
|
|
747
|
+
},
|
|
742
748
|
);
|
|
743
749
|
if ( req.body.sortColumName && req.body.sortColumName !== '' && req.body.sortBy ) {
|
|
744
750
|
query.push( {
|
|
@@ -841,15 +847,11 @@ export async function infraTable( req, res ) {
|
|
|
841
847
|
await download( exportdata, res );
|
|
842
848
|
return;
|
|
843
849
|
}
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
} );
|
|
850
|
-
} else {
|
|
851
|
-
res.sendError( 'no data', 204 );
|
|
852
|
-
}
|
|
850
|
+
res.sendSuccess( {
|
|
851
|
+
response: response,
|
|
852
|
+
count: count.length,
|
|
853
|
+
result: result,
|
|
854
|
+
} );
|
|
853
855
|
} catch ( error ) {
|
|
854
856
|
logger.error( { error: error, function: 'infraTable' } );
|
|
855
857
|
return res.sendError( error, 500 );
|
|
@@ -976,6 +978,11 @@ export async function installationTable( req, res ) {
|
|
|
976
978
|
secondaryIssue: { $last: '$secondaryIssue' },
|
|
977
979
|
},
|
|
978
980
|
},
|
|
981
|
+
{
|
|
982
|
+
$sort: {
|
|
983
|
+
ticketId: -1,
|
|
984
|
+
},
|
|
985
|
+
},
|
|
979
986
|
);
|
|
980
987
|
if ( req.body.sortColumName && req.body.sortColumName !== '' && req.body.sortBy ) {
|
|
981
988
|
query.push( {
|
|
@@ -1077,15 +1084,11 @@ export async function installationTable( req, res ) {
|
|
|
1077
1084
|
await download( exportdata, res );
|
|
1078
1085
|
return;
|
|
1079
1086
|
}
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
} );
|
|
1086
|
-
} else {
|
|
1087
|
-
res.sendError( 'no data', 204 );
|
|
1088
|
-
}
|
|
1087
|
+
res.sendSuccess( {
|
|
1088
|
+
response: response,
|
|
1089
|
+
count: count.length,
|
|
1090
|
+
result: result,
|
|
1091
|
+
} );
|
|
1089
1092
|
} catch ( error ) {
|
|
1090
1093
|
logger.error( { error: error, function: 'installationTable' } );
|
|
1091
1094
|
return res.sendError( error, 500 );
|
|
@@ -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.
|
|
532
|
-
'Store Name': element.basicDetails.
|
|
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 );
|
|
@@ -75,6 +75,17 @@ export async function userTakeTicket( req, res ) {
|
|
|
75
75
|
let query = {
|
|
76
76
|
'status': { $ne: 'closed' },
|
|
77
77
|
'issueType': 'mat',
|
|
78
|
+
'ticketDetails.addressingUser': { $exists: false },
|
|
79
|
+
};
|
|
80
|
+
if ( assignedClients.length > 0 ) {
|
|
81
|
+
query =( { ...query, ...{ 'basicDetails.clientId': { $in: assignedClients } } } );
|
|
82
|
+
}
|
|
83
|
+
userTicket = await findOneTangoTicket( query );
|
|
84
|
+
} else if ( req.body.issueType == 'dataMismatch' ) {
|
|
85
|
+
let query = {
|
|
86
|
+
'status': { $ne: 'closed' },
|
|
87
|
+
'issueType': { $in: [ 'highcount', 'lowcount' ] },
|
|
88
|
+
'ticketDetails.addressingUser': { $exists: false },
|
|
78
89
|
};
|
|
79
90
|
if ( assignedClients.length > 0 ) {
|
|
80
91
|
query =( { ...query, ...{ 'basicDetails.clientId': { $in: assignedClients } } } );
|
|
@@ -97,15 +108,26 @@ export async function userTakeTicket( req, res ) {
|
|
|
97
108
|
export async function userTicketList( req, res ) {
|
|
98
109
|
try {
|
|
99
110
|
let date = await getUTC( new Date( req.body.fromDate ), new Date( req.body.toDate ) );
|
|
100
|
-
let query = [
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
111
|
+
let query = [];
|
|
112
|
+
if ( req.body.issueType!='dataMismatch' ) {
|
|
113
|
+
query.push( {
|
|
114
|
+
$match: {
|
|
115
|
+
$and: [
|
|
116
|
+
{ issueType: req.body.issueType },
|
|
117
|
+
{ 'ticketDetails.addressingUser': new mongoose.Types.ObjectId( req.body.userId ) },
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
} );
|
|
121
|
+
} else {
|
|
122
|
+
query.push( {
|
|
123
|
+
$match: {
|
|
124
|
+
$and: [
|
|
125
|
+
{ issueType: { $in: [ 'highcount', 'lowcount' ] } },
|
|
126
|
+
{ 'ticketDetails.addressingUser': new mongoose.Types.ObjectId( req.body.userId ) },
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
} );
|
|
130
|
+
}
|
|
109
131
|
if ( req.body.status != 'closed' || req.body.export ) {
|
|
110
132
|
query.push( {
|
|
111
133
|
$match: {
|
|
@@ -132,6 +154,7 @@ export async function userTicketList( req, res ) {
|
|
|
132
154
|
query.push( {
|
|
133
155
|
$project: {
|
|
134
156
|
storeId: '$basicDetails.storeId',
|
|
157
|
+
storeName: '$basicDetails.storeName',
|
|
135
158
|
Date: { $dateToString: { format: '%d-%m-%Y', date: '$issueDate' } },
|
|
136
159
|
updatedAt: 1,
|
|
137
160
|
ticketId: 1,
|
|
@@ -162,6 +185,7 @@ export async function userTicketList( req, res ) {
|
|
|
162
185
|
{
|
|
163
186
|
$project: {
|
|
164
187
|
storeId: 1,
|
|
188
|
+
storeName: 1,
|
|
165
189
|
updatedAt: 1,
|
|
166
190
|
Date: 1,
|
|
167
191
|
ticketId: 1,
|
|
@@ -177,6 +201,7 @@ export async function userTicketList( req, res ) {
|
|
|
177
201
|
$group: {
|
|
178
202
|
_id: '$ticketId',
|
|
179
203
|
storeId: { $first: '$storeId' },
|
|
204
|
+
storeName: { $first: '$storeName' },
|
|
180
205
|
updatedAt: { $first: '$updatedAt' },
|
|
181
206
|
Date: { $first: '$Date' },
|
|
182
207
|
ticketId: { $first: '$ticketId' },
|
|
@@ -196,6 +221,7 @@ export async function userTicketList( req, res ) {
|
|
|
196
221
|
$or: [
|
|
197
222
|
{ storeId: { $regex: req.body.searchValue, $options: 'i' } },
|
|
198
223
|
{ infraIssue: { $regex: req.body.searchValue, $options: 'i' } },
|
|
224
|
+
{ storeName: { $regex: req.body.searchValue, $options: 'i' } },
|
|
199
225
|
],
|
|
200
226
|
},
|
|
201
227
|
} );
|
|
@@ -211,7 +237,6 @@ export async function userTicketList( req, res ) {
|
|
|
211
237
|
} );
|
|
212
238
|
}
|
|
213
239
|
let ticketList = await aggregateTangoTicket( query );
|
|
214
|
-
console.log( ticketList );
|
|
215
240
|
if ( req.body.export ) {
|
|
216
241
|
const exportdata = [];
|
|
217
242
|
ticketList.forEach( ( element ) => {
|
|
@@ -304,16 +329,28 @@ export async function basicDetails( req, res ) {
|
|
|
304
329
|
export async function workHistory( req, res ) {
|
|
305
330
|
try {
|
|
306
331
|
let date = await getUTC( new Date( req.body.fromDate ), new Date( req.body.toDate ) );
|
|
307
|
-
let query = [
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
332
|
+
let query = [ ];
|
|
333
|
+
if ( req.body.issueType!='dataMismatch' ) {
|
|
334
|
+
query.push( {
|
|
335
|
+
$match: {
|
|
336
|
+
$and: [
|
|
337
|
+
{ 'status': 'closed' },
|
|
338
|
+
{ issueType: req.body.issueType },
|
|
339
|
+
{ 'ticketDetails.addressingUser': new mongoose.Types.ObjectId( req.body.userId ) },
|
|
340
|
+
],
|
|
341
|
+
},
|
|
342
|
+
} );
|
|
343
|
+
} else {
|
|
344
|
+
query.push( {
|
|
345
|
+
$match: {
|
|
346
|
+
$and: [
|
|
347
|
+
{ 'status': 'closed' },
|
|
348
|
+
{ issueType: { $in: [ 'highcount', 'lowcount' ] } },
|
|
349
|
+
{ 'ticketDetails.addressingUser': new mongoose.Types.ObjectId( req.body.userId ) },
|
|
350
|
+
],
|
|
351
|
+
},
|
|
352
|
+
} );
|
|
353
|
+
}
|
|
317
354
|
if ( req.body.dateFilter && req.body.dateFilter != '' ) {
|
|
318
355
|
if ( req.body.dateFilter === 'issueIdentifiedDate' ) {
|
|
319
356
|
query.push(
|
|
@@ -374,6 +411,7 @@ export async function workHistory( req, res ) {
|
|
|
374
411
|
issueClosedDate: { $dateToString: { format: '%Y-%m-%d', date: '$issueClosedDate' } },
|
|
375
412
|
issueIdentifiedDate: { $dateToString: { format: '%Y-%m-%d', date: '$ticketDetails.issueIdentifiedDate' } },
|
|
376
413
|
ticketId: 1,
|
|
414
|
+
status: 1,
|
|
377
415
|
issueStatus: '$ticketDetails.issueStatus',
|
|
378
416
|
ticketType: '$ticketDetails.ticketType',
|
|
379
417
|
primaryIssue: {
|
|
@@ -456,7 +494,7 @@ export async function workHistory( req, res ) {
|
|
|
456
494
|
'ISSUE IDENTIFIED DATE': element.issueIdentifiedDate,
|
|
457
495
|
'CLOSED ON': element.issueClosedDate,
|
|
458
496
|
'ISSUE': element.infraIssue?element.infraIssue:'-',
|
|
459
|
-
|
|
497
|
+
'STATUS': element.status,
|
|
460
498
|
} );
|
|
461
499
|
} );
|
|
462
500
|
await download( exportdata, res );
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { isAllowedSessionHandler, authorize } from 'tango-app-api-middleware';
|
|
3
|
+
import { createTicket } from '../controllers/dataMismatch.controller.js';
|
|
4
|
+
import { validateDetails } from '../validations/infra.validation.js';
|
|
5
|
+
export const dataMismatchRouter = express.Router();
|
|
6
|
+
|
|
7
|
+
dataMismatchRouter.post( '/createTicket', isAllowedSessionHandler, authorize( {
|
|
8
|
+
userType: [ 'client', 'tango' ], access: [
|
|
9
|
+
{ featureName: 'manage', name: 'tickets', permissions: [ 'isView', 'isEdit' ] } ],
|
|
10
|
+
} ), validateDetails, createTicket );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import express from 'express';
|
|
3
3
|
import { isAllowedSessionHandler, authorize } from 'tango-app-api-middleware';
|
|
4
|
-
import { validateDetails, bulkvalidateDetails, validateTicket, bulkvalidateTicket, ticketExists, infraReasonExists, InfrastepstoResolve, InfraAlert } from '../validations/infra.validation.js';
|
|
4
|
+
import { validateDetails, bulkvalidateDetails, validateTicket, bulkvalidateTicket, validateTicketstatus, ticketExists, infraReasonExists, InfrastepstoResolve, InfraAlert } from '../validations/infra.validation.js';
|
|
5
5
|
import { createTicket, bulkcreateTicket, updateStatus, createReason, PrimaryReasons, matTable,
|
|
6
6
|
secondaryReason, updateTicketIssue, viewTicket, AlertTicketReply, uploadAttachments,
|
|
7
7
|
updateInstallationTicket, emailUserList, saveInfraEmailConfig, invoice, infraTable, storeFilter, assignTicket, installationTable } from '../controllers/infra.controllers.js';
|
|
@@ -29,7 +29,7 @@ infraRouter.post( '/secondaryReason', isAllowedSessionHandler, authorize( {
|
|
|
29
29
|
infraRouter.post( '/updateTicketIssue', isAllowedSessionHandler, authorize( {
|
|
30
30
|
userType: [ 'client', 'tango' ], access: [
|
|
31
31
|
{ featureName: 'manage', name: 'tickets', permissions: [ 'isEdit' ] } ],
|
|
32
|
-
} ), ticketExists, infraReasonExists, InfrastepstoResolve, InfraAlert, updateTicketIssue );
|
|
32
|
+
} ), ticketExists, validateTicketstatus, infraReasonExists, InfrastepstoResolve, InfraAlert, updateTicketIssue );
|
|
33
33
|
infraRouter.post( '/viewTicket', isAllowedSessionHandler, authorize( {
|
|
34
34
|
userType: [ 'client', 'tango' ], access: [
|
|
35
35
|
{ featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
|
|
@@ -184,12 +184,47 @@ export async function ticketExists( req, res, next ) {
|
|
|
184
184
|
req.body.basicDetails = Ticket.basicDetails;
|
|
185
185
|
req.body.ticketDetails = Ticket.ticketDetails;
|
|
186
186
|
req.body.ticketActivity = Ticket.ticketActivity;
|
|
187
|
+
req.body.status = Ticket.status;
|
|
188
|
+
req.body.issueDate = Ticket.issueDate;
|
|
189
|
+
|
|
190
|
+
|
|
187
191
|
next();
|
|
188
192
|
} catch ( error ) {
|
|
189
193
|
logger.error( { error: error, function: 'ticketExists' } );
|
|
190
194
|
return res.sendError( error, 500 );
|
|
191
195
|
}
|
|
192
196
|
};
|
|
197
|
+
|
|
198
|
+
export async function validateTicketstatus( req, res, next ) {
|
|
199
|
+
try {
|
|
200
|
+
if ( req.body.issueType == 'infra' ) {
|
|
201
|
+
if ( req.body.secondary.length>0 ) {
|
|
202
|
+
if ( req.body.status == 'closed' ) {
|
|
203
|
+
return res.sendSuccess( 'Ticket already closed' );
|
|
204
|
+
}
|
|
205
|
+
console.log( req.body.ticketDetails );
|
|
206
|
+
|
|
207
|
+
if ( req.body.ticketDetails.ticketType==='firsttimeticket'&&req.body.ticketDetails.issueStatus==='identified' ) {
|
|
208
|
+
return res.sendSuccess( 'Ticket already Addressed' );
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
if ( req.body.primary == 'Application Issues' ) {
|
|
212
|
+
if ( req.body.status == 'closed' ) {
|
|
213
|
+
return res.sendSuccess( 'Ticket already closed' );
|
|
214
|
+
}
|
|
215
|
+
if ( req.body.ticketDetails.ticketType==='firsttimeticket'&&req.body.ticketDetails.issueStatus==='identified' ) {
|
|
216
|
+
return res.sendSuccess( 'Ticket already Addressed' );
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
next();
|
|
222
|
+
} catch ( error ) {
|
|
223
|
+
logger.error( { error: error, function: 'validateTicket' } );
|
|
224
|
+
return res.sendError( error, 500 );
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
193
228
|
export async function infraReasonExists( req, res, next ) {
|
|
194
229
|
try {
|
|
195
230
|
if ( req.body.primary && req.body.secondary && req.body.secondary.length ) {
|