tango-app-api-infra 3.0.64-dev → 3.0.66-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 +1 -4
- package/package.json +5 -3
- package/src/controllers/clientInfra.controller.js +7 -39
- package/src/controllers/infra.controllers.js +103 -676
- package/src/controllers/internalInfra.controller.js +103 -557
- package/src/controllers/storeInfra.controlller.js +7 -37
- package/src/controllers/userInfra.controller.js +22 -75
- package/src/docs/infra.docs.js +28 -0
- package/src/dtos/infra.dtos.js +12 -0
- package/src/routes/infra.routes.js +8 -25
- package/src/routes/internalInfra.routes.js +1 -4
- package/src/services/tangoTicket.service.js +0 -3
- package/src/validations/infra.validation.js +7 -53
- package/src/controllers/dataMismatch.controller.js +0 -23
- package/src/controllers/employeeTraning.controller.js +0 -50
- package/src/routes/dataMismatch.routes.js +0 -10
- package/src/routes/employeetrainig.routes.js +0 -17
|
@@ -4,7 +4,7 @@ import { aggregateTangoTicket } from '../services/tangoTicket.service.js';
|
|
|
4
4
|
import { findOneStore } from '../services/store.service.js';
|
|
5
5
|
import dayjs from 'dayjs';
|
|
6
6
|
import { findinfraReason } from '../services/infraReason.service.js';
|
|
7
|
-
import { signedUrl
|
|
7
|
+
import { signedUrl } from 'tango-app-api-middleware';
|
|
8
8
|
export async function storeTicketList( req, res ) {
|
|
9
9
|
try {
|
|
10
10
|
let date = await getUTC( new Date( req.body.fromDate ), new Date( req.body.toDate ) );
|
|
@@ -28,20 +28,7 @@ export async function storeTicketList( req, res ) {
|
|
|
28
28
|
ticketId: 1,
|
|
29
29
|
issueStatus: '$ticketDetails.issueStatus',
|
|
30
30
|
ticketType: '$ticketDetails.ticketType',
|
|
31
|
-
|
|
32
|
-
$filter: {
|
|
33
|
-
input: '$ticketActivity',
|
|
34
|
-
as: 'item',
|
|
35
|
-
cond: { $eq: [ '$$item.actionType', 'comment' ] },
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
comments: {
|
|
39
|
-
$filter: {
|
|
40
|
-
input: '$ticketActivity',
|
|
41
|
-
as: 'item',
|
|
42
|
-
cond: { $ne: [ '$$item.actionType', 'statusChange' ] },
|
|
43
|
-
},
|
|
44
|
-
},
|
|
31
|
+
comments: { $size: '$ticketActivity' },
|
|
45
32
|
primaryIssue: {
|
|
46
33
|
$filter: {
|
|
47
34
|
input: '$ticketActivity',
|
|
@@ -56,21 +43,11 @@ export async function storeTicketList( req, res ) {
|
|
|
56
43
|
path: '$primaryIssue', preserveNullAndEmptyArrays: true,
|
|
57
44
|
},
|
|
58
45
|
},
|
|
59
|
-
{
|
|
60
|
-
$unwind: {
|
|
61
|
-
path: '$otherscomment', preserveNullAndEmptyArrays: true,
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
46
|
{
|
|
65
47
|
$unwind: {
|
|
66
48
|
path: '$primaryIssue.reasons', preserveNullAndEmptyArrays: true,
|
|
67
49
|
},
|
|
68
50
|
},
|
|
69
|
-
{
|
|
70
|
-
$unwind: {
|
|
71
|
-
path: '$primaryIssue.reasons.secondaryIssue', preserveNullAndEmptyArrays: true,
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
51
|
{
|
|
75
52
|
$project: {
|
|
76
53
|
storeId: 1,
|
|
@@ -80,12 +57,10 @@ export async function storeTicketList( req, res ) {
|
|
|
80
57
|
ticketId: 1,
|
|
81
58
|
issueStatus: 1,
|
|
82
59
|
ticketType: 1,
|
|
83
|
-
comments:
|
|
60
|
+
comments: 1,
|
|
84
61
|
issueDate: 1,
|
|
85
|
-
commentText: '$primaryIssue.comment',
|
|
86
62
|
primaryIssue: '$primaryIssue.reasons.primaryIssue',
|
|
87
|
-
secondaryIssue: '$primaryIssue.reasons.secondaryIssue
|
|
88
|
-
otherscomment: '$otherscomment.comment',
|
|
63
|
+
secondaryIssue: '$primaryIssue.reasons.secondaryIssue',
|
|
89
64
|
},
|
|
90
65
|
},
|
|
91
66
|
{
|
|
@@ -100,11 +75,8 @@ export async function storeTicketList( req, res ) {
|
|
|
100
75
|
issueStatus: { $first: '$issueStatus' },
|
|
101
76
|
ticketType: { $first: '$ticketType' },
|
|
102
77
|
comments: { $first: '$comments' },
|
|
103
|
-
commentText: { $last: '$commentText' },
|
|
104
78
|
primaryIssue: { $last: '$primaryIssue' },
|
|
105
79
|
secondaryIssue: { $last: '$secondaryIssue' },
|
|
106
|
-
otherscomment: { $last: '$otherscomment' },
|
|
107
|
-
|
|
108
80
|
},
|
|
109
81
|
},
|
|
110
82
|
{
|
|
@@ -130,10 +102,8 @@ export async function storeTicketList( req, res ) {
|
|
|
130
102
|
'TICKET ID': element.ticketId,
|
|
131
103
|
'DATE': element.Date,
|
|
132
104
|
'ISSUE CLOSED DATE': element.issueClosedDate,
|
|
133
|
-
'
|
|
134
|
-
'SECONDARY ISSUE': element.secondaryIssue,
|
|
105
|
+
'ISSUE': element.primaryIssue,
|
|
135
106
|
'STATUS': element.status,
|
|
136
|
-
'COMMENT': element.otherscomment?element.otherscomment:element.commentText,
|
|
137
107
|
} );
|
|
138
108
|
} );
|
|
139
109
|
await download( exportdata, res );
|
|
@@ -367,7 +337,7 @@ export async function edgeAppLogTable( req, res ) {
|
|
|
367
337
|
const average = sum / streamwiseDowntime.length;
|
|
368
338
|
obj.downtime = Math.round( average );
|
|
369
339
|
} else {
|
|
370
|
-
obj.downtime ='';
|
|
340
|
+
obj.downtime = '';
|
|
371
341
|
}
|
|
372
342
|
let appStatusQuery = {
|
|
373
343
|
'size': 1,
|
|
@@ -833,7 +803,7 @@ export async function cameraAngleChange( req, res ) {
|
|
|
833
803
|
let changeDetected = result.camera_info.filter( ( cam ) => cam.stream == req.body.StreamName );
|
|
834
804
|
if ( changeDetected.length == 1 ) {
|
|
835
805
|
let params = {
|
|
836
|
-
Bucket:
|
|
806
|
+
Bucket: 'tango-client-sandbox',
|
|
837
807
|
file_path: changeDetected[0].path,
|
|
838
808
|
};
|
|
839
809
|
let Image = await signedUrl( params );
|
|
@@ -71,26 +71,6 @@ export async function userTakeTicket( req, res ) {
|
|
|
71
71
|
}
|
|
72
72
|
userTicket = await findOneTangoTicket( query );
|
|
73
73
|
}
|
|
74
|
-
} else if ( req.body.issueType == 'mat' ) {
|
|
75
|
-
let query = {
|
|
76
|
-
'status': { $ne: 'closed' },
|
|
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 },
|
|
89
|
-
};
|
|
90
|
-
if ( assignedClients.length > 0 ) {
|
|
91
|
-
query =( { ...query, ...{ 'basicDetails.clientId': { $in: assignedClients } } } );
|
|
92
|
-
}
|
|
93
|
-
userTicket = await findOneTangoTicket( query );
|
|
94
74
|
}
|
|
95
75
|
if ( userTicket ) {
|
|
96
76
|
let assignTicket = await updateOneTangoTicket( { ticketId: userTicket.ticketId }, { 'ticketDetails.addressingUser': req.body.userId } );
|
|
@@ -108,28 +88,15 @@ export async function userTakeTicket( req, res ) {
|
|
|
108
88
|
export async function userTicketList( req, res ) {
|
|
109
89
|
try {
|
|
110
90
|
let date = await getUTC( new Date( req.body.fromDate ), new Date( req.body.toDate ) );
|
|
111
|
-
let query = [
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
},
|
|
121
|
-
} );
|
|
122
|
-
} else {
|
|
123
|
-
query.push( {
|
|
124
|
-
$match: {
|
|
125
|
-
$and: [
|
|
126
|
-
{ 'basicDetails.clientId': { $in: req.body.clientId } },
|
|
127
|
-
{ issueType: { $in: [ 'highcount', 'lowcount' ] } },
|
|
128
|
-
{ 'ticketDetails.addressingUser': new mongoose.Types.ObjectId( req.body.userId ) },
|
|
129
|
-
],
|
|
130
|
-
},
|
|
131
|
-
} );
|
|
132
|
-
}
|
|
91
|
+
let query = [ {
|
|
92
|
+
$match: {
|
|
93
|
+
$and: [
|
|
94
|
+
|
|
95
|
+
{ issueType: req.body.issueType },
|
|
96
|
+
{ 'ticketDetails.addressingUser': new mongoose.Types.ObjectId( req.body.userId ) },
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
} ];
|
|
133
100
|
if ( req.body.status != 'closed' || req.body.export ) {
|
|
134
101
|
query.push( {
|
|
135
102
|
$match: {
|
|
@@ -156,7 +123,6 @@ export async function userTicketList( req, res ) {
|
|
|
156
123
|
query.push( {
|
|
157
124
|
$project: {
|
|
158
125
|
storeId: '$basicDetails.storeId',
|
|
159
|
-
storeName: '$basicDetails.storeName',
|
|
160
126
|
Date: { $dateToString: { format: '%d-%m-%Y', date: '$issueDate' } },
|
|
161
127
|
updatedAt: 1,
|
|
162
128
|
ticketId: 1,
|
|
@@ -187,7 +153,6 @@ export async function userTicketList( req, res ) {
|
|
|
187
153
|
{
|
|
188
154
|
$project: {
|
|
189
155
|
storeId: 1,
|
|
190
|
-
storeName: 1,
|
|
191
156
|
updatedAt: 1,
|
|
192
157
|
Date: 1,
|
|
193
158
|
ticketId: 1,
|
|
@@ -203,7 +168,6 @@ export async function userTicketList( req, res ) {
|
|
|
203
168
|
$group: {
|
|
204
169
|
_id: '$ticketId',
|
|
205
170
|
storeId: { $first: '$storeId' },
|
|
206
|
-
storeName: { $first: '$storeName' },
|
|
207
171
|
updatedAt: { $first: '$updatedAt' },
|
|
208
172
|
Date: { $first: '$Date' },
|
|
209
173
|
ticketId: { $first: '$ticketId' },
|
|
@@ -223,7 +187,6 @@ export async function userTicketList( req, res ) {
|
|
|
223
187
|
$or: [
|
|
224
188
|
{ storeId: { $regex: req.body.searchValue, $options: 'i' } },
|
|
225
189
|
{ infraIssue: { $regex: req.body.searchValue, $options: 'i' } },
|
|
226
|
-
{ storeName: { $regex: req.body.searchValue, $options: 'i' } },
|
|
227
190
|
],
|
|
228
191
|
},
|
|
229
192
|
} );
|
|
@@ -331,30 +294,16 @@ export async function basicDetails( req, res ) {
|
|
|
331
294
|
export async function workHistory( req, res ) {
|
|
332
295
|
try {
|
|
333
296
|
let date = await getUTC( new Date( req.body.fromDate ), new Date( req.body.toDate ) );
|
|
334
|
-
let query = [
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
},
|
|
345
|
-
} );
|
|
346
|
-
} else {
|
|
347
|
-
query.push( {
|
|
348
|
-
$match: {
|
|
349
|
-
$and: [
|
|
350
|
-
{ 'basicDetails.clientId': { $in: req.body.clientId } },
|
|
351
|
-
{ 'status': 'closed' },
|
|
352
|
-
{ issueType: { $in: [ 'highcount', 'lowcount' ] } },
|
|
353
|
-
{ 'ticketDetails.addressingUser': new mongoose.Types.ObjectId( req.body.userId ) },
|
|
354
|
-
],
|
|
355
|
-
},
|
|
356
|
-
} );
|
|
357
|
-
}
|
|
297
|
+
let query = [ {
|
|
298
|
+
$match: {
|
|
299
|
+
$and: [
|
|
300
|
+
{ 'status': 'closed' },
|
|
301
|
+
{ issueType: req.body.issueType },
|
|
302
|
+
{ 'ticketDetails.addressingUser': new mongoose.Types.ObjectId( req.body.userId ) },
|
|
303
|
+
],
|
|
304
|
+
},
|
|
305
|
+
} ];
|
|
306
|
+
|
|
358
307
|
if ( req.body.dateFilter && req.body.dateFilter != '' ) {
|
|
359
308
|
if ( req.body.dateFilter === 'issueIdentifiedDate' ) {
|
|
360
309
|
query.push(
|
|
@@ -415,7 +364,6 @@ export async function workHistory( req, res ) {
|
|
|
415
364
|
issueClosedDate: { $dateToString: { format: '%Y-%m-%d', date: '$issueClosedDate' } },
|
|
416
365
|
issueIdentifiedDate: { $dateToString: { format: '%Y-%m-%d', date: '$ticketDetails.issueIdentifiedDate' } },
|
|
417
366
|
ticketId: 1,
|
|
418
|
-
status: 1,
|
|
419
367
|
issueStatus: '$ticketDetails.issueStatus',
|
|
420
368
|
ticketType: '$ticketDetails.ticketType',
|
|
421
369
|
primaryIssue: {
|
|
@@ -447,7 +395,6 @@ export async function workHistory( req, res ) {
|
|
|
447
395
|
issueClosedDate: 1,
|
|
448
396
|
ticketId: 1,
|
|
449
397
|
issueStatus: 1,
|
|
450
|
-
status: 1,
|
|
451
398
|
ticketType: 1,
|
|
452
399
|
infraIssue: { $ifNull: [ '$primaryIssue.reasons.primaryIssue', '' ] },
|
|
453
400
|
},
|
|
@@ -490,15 +437,15 @@ export async function workHistory( req, res ) {
|
|
|
490
437
|
const exportdata = [];
|
|
491
438
|
result.forEach( ( element ) => {
|
|
492
439
|
exportdata.push( {
|
|
493
|
-
'CREATED ON':
|
|
440
|
+
'CREATED ON': element.createdAt,
|
|
494
441
|
'TICKET ID': element.ticketId,
|
|
495
442
|
'STORE ID': element.storeId,
|
|
496
443
|
'STORE NAME': element.storeName,
|
|
497
444
|
'CLIENT ID': element.clientId,
|
|
498
445
|
'CLIENT NAME': element.clientName,
|
|
446
|
+
'CREATED STATUS': element.status,
|
|
499
447
|
'ISSUE IDENTIFIED DATE': element.issueIdentifiedDate,
|
|
500
448
|
'CLOSED ON': element.issueClosedDate,
|
|
501
|
-
'ISSUE': element.infraIssue?element.infraIssue:'-',
|
|
502
449
|
'STATUS': element.status,
|
|
503
450
|
} );
|
|
504
451
|
} );
|
|
@@ -644,7 +591,7 @@ export async function storeInfraList( req, res ) {
|
|
|
644
591
|
if ( installationcheck ) {
|
|
645
592
|
store.ticketId = installationcheck.ticketId;
|
|
646
593
|
store.status = installationcheck.ticketDetails.installationStatus;
|
|
647
|
-
if ( store.status === '
|
|
594
|
+
if ( store.status === 'onboareded' ) {
|
|
648
595
|
store.statusDetail = 'Ready to pair';
|
|
649
596
|
}
|
|
650
597
|
if ( store.status === 'paired' ) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import j2s from 'joi-to-swagger';
|
|
2
|
+
import { getInfraIssueValid } from '../dtos/infra.dtos.js';
|
|
3
|
+
|
|
4
|
+
export const infraDocs = {
|
|
5
|
+
|
|
6
|
+
'/v3/infraRouter/get-infra-issues': {
|
|
7
|
+
post: {
|
|
8
|
+
tags: [ 'infra' ],
|
|
9
|
+
description: `Get infra issues against store`,
|
|
10
|
+
operationId: 'get-infra-issues',
|
|
11
|
+
parameters: {},
|
|
12
|
+
requestBody: {
|
|
13
|
+
content: {
|
|
14
|
+
'application/json': {
|
|
15
|
+
schema: j2s( getInfraIssueValid ).swagger,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
responses: {
|
|
20
|
+
200: { description: 'Group has been created successfully' },
|
|
21
|
+
401: { description: 'Unauthorized User' },
|
|
22
|
+
422: { description: 'Field Error' },
|
|
23
|
+
500: { description: 'Server Error' },
|
|
24
|
+
204: { description: 'Not Found' },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
|
|
3
|
+
export const getInfraIssueSchema = Joi.object().keys( {
|
|
4
|
+
fromDate: Joi.string().required(),
|
|
5
|
+
toDate: Joi.string().required(),
|
|
6
|
+
storeId: Joi.string().required(),
|
|
7
|
+
|
|
8
|
+
} );
|
|
9
|
+
|
|
10
|
+
export const getInfraIssueValid = {
|
|
11
|
+
body: getInfraIssueSchema,
|
|
12
|
+
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
import express from 'express';
|
|
3
|
-
import { isAllowedSessionHandler, authorize } from 'tango-app-api-middleware';
|
|
4
|
-
import { validateDetails, bulkvalidateDetails, validateTicket, bulkvalidateTicket,
|
|
5
|
-
import { createTicket, bulkcreateTicket, updateStatus, createReason, PrimaryReasons,
|
|
3
|
+
import { isAllowedSessionHandler, authorize, validate } from 'tango-app-api-middleware';
|
|
4
|
+
import { validateDetails, bulkvalidateDetails, validateTicket, bulkvalidateTicket, ticketExists, infraReasonExists, InfrastepstoResolve, InfraAlert } from '../validations/infra.validation.js';
|
|
5
|
+
import { createTicket, bulkcreateTicket, updateStatus, createReason, PrimaryReasons,
|
|
6
6
|
secondaryReason, updateTicketIssue, viewTicket, AlertTicketReply, uploadAttachments,
|
|
7
|
-
updateInstallationTicket, emailUserList, saveInfraEmailConfig, invoice,
|
|
7
|
+
updateInstallationTicket, emailUserList, saveInfraEmailConfig, invoice,
|
|
8
|
+
getInfraIssues } from '../controllers/infra.controllers.js';
|
|
9
|
+
import { getInfraIssueValid } from '../dtos/infra.dtos.js';
|
|
8
10
|
|
|
9
11
|
|
|
10
12
|
export const infraRouter = express.Router();
|
|
@@ -29,7 +31,7 @@ infraRouter.post( '/secondaryReason', isAllowedSessionHandler, authorize( {
|
|
|
29
31
|
infraRouter.post( '/updateTicketIssue', isAllowedSessionHandler, authorize( {
|
|
30
32
|
userType: [ 'client', 'tango' ], access: [
|
|
31
33
|
{ featureName: 'manage', name: 'tickets', permissions: [ 'isEdit' ] } ],
|
|
32
|
-
} ), ticketExists,
|
|
34
|
+
} ), ticketExists, infraReasonExists, InfrastepstoResolve, InfraAlert, updateTicketIssue );
|
|
33
35
|
infraRouter.post( '/viewTicket', isAllowedSessionHandler, authorize( {
|
|
34
36
|
userType: [ 'client', 'tango' ], access: [
|
|
35
37
|
{ featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
|
|
@@ -55,23 +57,4 @@ infraRouter.post( '/saveInfraEmailConfig', isAllowedSessionHandler, authorize( {
|
|
|
55
57
|
{ featureName: 'settings', name: 'configuration', permissions: [ 'isEdit', 'isView' ] } ],
|
|
56
58
|
} ), saveInfraEmailConfig );
|
|
57
59
|
infraRouter.post( '/invoice', invoice );
|
|
58
|
-
infraRouter.post( '/
|
|
59
|
-
userType: [ 'client', 'tango' ], access: [
|
|
60
|
-
{ featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
|
|
61
|
-
} ), infraTable );
|
|
62
|
-
infraRouter.post( '/installationTable', isAllowedSessionHandler, authorize( {
|
|
63
|
-
userType: [ 'client', 'tango' ], access: [
|
|
64
|
-
{ featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
|
|
65
|
-
} ), installationTable );
|
|
66
|
-
infraRouter.post( '/matTable', isAllowedSessionHandler, authorize( {
|
|
67
|
-
userType: [ 'client', 'tango' ], access: [
|
|
68
|
-
{ featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
|
|
69
|
-
} ), matTable );
|
|
70
|
-
infraRouter.post( '/assignTicket', isAllowedSessionHandler, authorize( {
|
|
71
|
-
userType: [ 'client', 'tango' ], access: [
|
|
72
|
-
{ featureName: 'manage', name: 'tickets', permissions: [ 'isEdit', 'isView' ] } ],
|
|
73
|
-
} ), assignTicket );
|
|
74
|
-
infraRouter.post( '/storeFilter', isAllowedSessionHandler, authorize( {
|
|
75
|
-
userType: [ 'client', 'tango' ], access: [
|
|
76
|
-
{ featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
|
|
77
|
-
} ), storeFilter );
|
|
60
|
+
infraRouter.post( '/get-infra-issues', validate( getInfraIssueValid ), getInfraIssues );
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import express from 'express';
|
|
3
3
|
import {
|
|
4
4
|
migrateClient, migrateStores, basicList, clientList, setTicketTime, downStoresList,
|
|
5
|
-
openTicketList, assigntoUser, updateRefreshTicket, closeTicket,
|
|
5
|
+
openTicketList, assigntoUser, updateRefreshTicket, closeTicket, emailUserList, infraReportSent,
|
|
6
6
|
} from '../controllers/internalInfra.controller.js';
|
|
7
7
|
|
|
8
8
|
export const internalInfraRouter = express.Router();
|
|
@@ -19,8 +19,5 @@ internalInfraRouter.post( '/updateRefreshTicket', updateRefreshTicket );
|
|
|
19
19
|
internalInfraRouter.post( '/closeTicket', closeTicket );
|
|
20
20
|
internalInfraRouter.get( '/emailUserList', emailUserList );
|
|
21
21
|
internalInfraRouter.post( '/infraReportSent', infraReportSent );
|
|
22
|
-
internalInfraRouter.post( '/spocmailchange', spocmailchange );
|
|
23
|
-
internalInfraRouter.post( '/camAngleChangeReport', camAngleChangeReport );
|
|
24
|
-
internalInfraRouter.post( '/edgeApplogsCheck', edgeApplogsCheck );
|
|
25
22
|
|
|
26
23
|
|
|
@@ -13,9 +13,6 @@ export async function findOneTangoTicket( query, project ) {
|
|
|
13
13
|
export async function updateOneTangoTicket( query, data ) {
|
|
14
14
|
return await dataModel.tangoTicketModel.updateOne( query, { $set: data } );
|
|
15
15
|
}
|
|
16
|
-
export async function updateManyTangoTicket( query, data ) {
|
|
17
|
-
return await dataModel.tangoTicketModel.updateMany( query, { $set: data } );
|
|
18
|
-
}
|
|
19
16
|
export async function countDocumentsTangoTicket( query, data ) {
|
|
20
17
|
return await dataModel.tangoTicketModel.countDocuments( query );
|
|
21
18
|
}
|
|
@@ -28,20 +28,17 @@ export async function validateDetails( req, res, next ) {
|
|
|
28
28
|
clientId: store.clientId,
|
|
29
29
|
clientName: client.clientName,
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
if ( req.body.issueType == 'infra' ) {
|
|
33
|
-
let refreshdate = dayjs().add( client.ticketConfigs.refreshAlert, 'days' );
|
|
34
33
|
req.body.ticketDetails = {
|
|
35
|
-
ticketRefreshTime:
|
|
34
|
+
ticketRefreshTime: dayjs().add( client.ticketConfigs.refreshAlert, 'days' ),
|
|
36
35
|
};
|
|
37
36
|
} else if ( req.body.issueType == 'installation' ) {
|
|
38
|
-
let refreshdate = dayjs().add( client.ticketConfigs.installationReAssign, 'days' );
|
|
39
37
|
req.body.ticketDetails = {
|
|
40
|
-
ticketRefreshTime:
|
|
38
|
+
ticketRefreshTime: dayjs().add( client.ticketConfigs.installationReAssign, 'days' ),
|
|
41
39
|
};
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
|
|
45
42
|
next();
|
|
46
43
|
} catch ( error ) {
|
|
47
44
|
logger.error( { error: error, function: 'validateDetails' } );
|
|
@@ -62,13 +59,12 @@ export async function validateTicket( req, res, next ) {
|
|
|
62
59
|
if ( Ticket ) {
|
|
63
60
|
return res.sendSuccess( 'Infra Ticket Already Exists for the day' );
|
|
64
61
|
}
|
|
65
|
-
|
|
66
62
|
let refreshTicket = await findOneTangoTicket(
|
|
67
63
|
{
|
|
68
64
|
'basicDetails.storeId': req.body.basicDetails.storeId,
|
|
69
65
|
'issueType': 'infra',
|
|
70
66
|
'status': { $ne: 'closed' },
|
|
71
|
-
'ticketDetails.
|
|
67
|
+
'ticketDetails.ticketType': 'refreshticket',
|
|
72
68
|
},
|
|
73
69
|
);
|
|
74
70
|
if ( refreshTicket ) {
|
|
@@ -184,45 +180,12 @@ export async function ticketExists( req, res, next ) {
|
|
|
184
180
|
req.body.basicDetails = Ticket.basicDetails;
|
|
185
181
|
req.body.ticketDetails = Ticket.ticketDetails;
|
|
186
182
|
req.body.ticketActivity = Ticket.ticketActivity;
|
|
187
|
-
req.body.status = Ticket.status;
|
|
188
|
-
req.body.issueDate = Ticket.issueDate;
|
|
189
|
-
|
|
190
|
-
|
|
191
183
|
next();
|
|
192
184
|
} catch ( error ) {
|
|
193
185
|
logger.error( { error: error, function: 'ticketExists' } );
|
|
194
186
|
return res.sendError( error, 500 );
|
|
195
187
|
}
|
|
196
188
|
};
|
|
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
|
-
if ( req.body.ticketDetails.ticketType==='firsttimeticket'&&req.body.ticketDetails.issueStatus==='identified' ) {
|
|
206
|
-
return res.sendSuccess( 'Ticket already Addressed' );
|
|
207
|
-
}
|
|
208
|
-
} else {
|
|
209
|
-
if ( req.body.primary == 'Application Issues' ) {
|
|
210
|
-
if ( req.body.status == 'closed' ) {
|
|
211
|
-
return res.sendSuccess( 'Ticket already closed' );
|
|
212
|
-
}
|
|
213
|
-
if ( req.body.ticketDetails.ticketType==='firsttimeticket'&&req.body.ticketDetails.issueStatus==='identified' ) {
|
|
214
|
-
return res.sendSuccess( 'Ticket already Addressed' );
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
next();
|
|
220
|
-
} catch ( error ) {
|
|
221
|
-
logger.error( { error: error, function: 'validateTicket' } );
|
|
222
|
-
return res.sendError( error, 500 );
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
189
|
export async function infraReasonExists( req, res, next ) {
|
|
227
190
|
try {
|
|
228
191
|
if ( req.body.primary && req.body.secondary && req.body.secondary.length ) {
|
|
@@ -339,24 +302,15 @@ export async function InfrastepstoResolve( req, res, next ) {
|
|
|
339
302
|
export async function InfraAlert( req, res, next ) {
|
|
340
303
|
try {
|
|
341
304
|
if ( req.body.hibernationDays ) {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
actionBy = 'Tango';
|
|
345
|
-
} else if ( req.user.userType == 'client' ) {
|
|
346
|
-
actionBy = 'User';
|
|
347
|
-
}
|
|
348
|
-
|
|
305
|
+
req.body.hibernationDays = dayjs().add( req.body.hibernationDays, 'days' ).format( 'YYYY-MM-DD' );
|
|
306
|
+
await updateOneStore( { storeId: req.body.basicDetails.storeId }, { 'ticketConfigs.hibernation': new Date( req.body.hibernationDays ) } );
|
|
349
307
|
req.body.ticketActivity.push( {
|
|
350
308
|
actionType: 'statusCheckReply',
|
|
351
|
-
actionBy:
|
|
309
|
+
actionBy: 'User',
|
|
352
310
|
timeStamp: new Date(),
|
|
353
|
-
statusCheckReply: 'No',
|
|
354
311
|
IdentifiedBy: req.user.userName,
|
|
355
312
|
hibernationDays: req.body.hibernationDays,
|
|
356
313
|
} );
|
|
357
|
-
req.body.hibernationDays = dayjs().add( req.body.hibernationDays, 'days' ).format( 'YYYY-MM-DD' );
|
|
358
|
-
await updateOneStore( { storeId: req.body.basicDetails.storeId }, { 'ticketConfigs.hibernation': new Date( req.body.hibernationDays ) } );
|
|
359
|
-
|
|
360
314
|
await updateOneTangoTicket( { ticketId: req.body.ticketId }, { 'hibernation': new Date( req.body.hibernationDays ) } );
|
|
361
315
|
} else {
|
|
362
316
|
if ( req.body.issueType == 'infra' ) {
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { createTangoTicket, findOneTangoTicket, updateOneTangoTicket } 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, 'basicDetails.storeId': req.body.storeId } );
|
|
7
|
-
if ( ticketExist ) {
|
|
8
|
-
return res.sendSuccess( 'MAT Ticket Already Exists for the store' );
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
req.body.issueDate = new Date( req.body.Date );
|
|
12
|
-
req.body.ticketId = 'TE_MAT_' + new Date().valueOf();
|
|
13
|
-
let create = await createTangoTicket( req.body );
|
|
14
|
-
if ( create ) {
|
|
15
|
-
res.sendSuccess( 'Ticket Created Successfully' );
|
|
16
|
-
}
|
|
17
|
-
} catch ( error ) {
|
|
18
|
-
logger.error( { error: error, function: 'createTicket mat' } );
|
|
19
|
-
return res.sendError( error, 500 );
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export async function updatecomment( req, res ) {
|
|
24
|
-
try {
|
|
25
|
-
if ( req.body.comment != '' ) {
|
|
26
|
-
req.body.ticketActivity.push( {
|
|
27
|
-
actionType: 'comment',
|
|
28
|
-
actionBy: 'Tango',
|
|
29
|
-
timeStamp: new Date(),
|
|
30
|
-
IdentifiedBy: req.user.userName,
|
|
31
|
-
comment: req.body.comment,
|
|
32
|
-
} );
|
|
33
|
-
}
|
|
34
|
-
let updateTicket = await updateOneTangoTicket( { ticketId: req.body.ticketId }, { ticketActivity: req.body.ticketActivity } );
|
|
35
|
-
if ( updateTicket ) {
|
|
36
|
-
res.sendSuccess( 'Ticket Updated Successfully' );
|
|
37
|
-
}
|
|
38
|
-
} catch ( error ) {
|
|
39
|
-
logger.error( { error: error, function: 'updatecomment mat' } );
|
|
40
|
-
return res.sendError( error, 500 );
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
export async function activityLog( req, res ) {
|
|
44
|
-
try {
|
|
45
|
-
res.sendSuccess( req.body );
|
|
46
|
-
} catch ( error ) {
|
|
47
|
-
logger.error( { error: error, function: 'activityLog mat' } );
|
|
48
|
-
return res.sendError( error, 500 );
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
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 dataMismatchTicketRouter = express.Router();
|
|
6
|
-
|
|
7
|
-
dataMismatchTicketRouter.post( '/createTicket', isAllowedSessionHandler, authorize( {
|
|
8
|
-
userType: [ 'client', 'tango' ], access: [
|
|
9
|
-
{ featureName: 'manage', name: 'tickets', permissions: [ 'isView', 'isEdit' ] } ],
|
|
10
|
-
} ), validateDetails, createTicket );
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { createTicket, updatecomment, activityLog } from '../controllers/employeeTraning.controller.js';
|
|
2
|
-
import { ticketExists, validateDetails } from '../validations/infra.validation.js';
|
|
3
|
-
import express from 'express';
|
|
4
|
-
import { isAllowedSessionHandler, authorize } from 'tango-app-api-middleware';
|
|
5
|
-
export const employeeTrainigRouter = express.Router();
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
employeeTrainigRouter.post( '/createTicket', validateDetails, createTicket );
|
|
9
|
-
employeeTrainigRouter.post( '/updatecomment', isAllowedSessionHandler, authorize( {
|
|
10
|
-
userType: [ 'tango' ], access: [
|
|
11
|
-
{ featureName: 'manage', name: 'tickets', permissions: [ 'isEdit' ] } ],
|
|
12
|
-
} ), ticketExists, updatecomment );
|
|
13
|
-
|
|
14
|
-
employeeTrainigRouter.post( '/activityLog', isAllowedSessionHandler, authorize( {
|
|
15
|
-
userType: [ 'tango' ], access: [
|
|
16
|
-
{ featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
|
|
17
|
-
} ), ticketExists, activityLog );
|