tango-app-api-infra 3.1.9 → 3.1.11
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 +1 -1
- package/src/controllers/clientInfra.controller.js +5 -7
- package/src/controllers/dataMismatch.controller.js +14 -0
- package/src/controllers/employeeTraning.controller.js +0 -4
- package/src/controllers/infra.controllers.js +22 -19
- package/src/controllers/userInfra.controller.js +2 -2
- 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
|
@@ -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 }, 'edge.firstFile': true,status:
|
|
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
|
],
|
|
@@ -151,14 +152,10 @@ export async function installationCard( req, res ) {
|
|
|
151
152
|
let onboardedCount = await countDocumentsStore( {
|
|
152
153
|
'$and': [
|
|
153
154
|
{ 'clientId': { $in: req.body.clientId } },
|
|
154
|
-
{ $or: [
|
|
155
|
-
{ 'edge.firstFile': true },
|
|
156
|
-
{ 'edge.firstFile': false },
|
|
157
|
-
] },
|
|
158
155
|
],
|
|
159
156
|
} );
|
|
160
157
|
let installedCount = await countDocumentsStore( { 'clientId': { $in: req.body.clientId },
|
|
161
|
-
|
|
158
|
+
'edge.firstFile': true, 'status': 'active' } );
|
|
162
159
|
|
|
163
160
|
let yettoInstallCount = await aggregateTangoTicket( [
|
|
164
161
|
{
|
|
@@ -270,6 +267,7 @@ export async function infraIssuesTable( req, res ) {
|
|
|
270
267
|
$match: {
|
|
271
268
|
$and: [
|
|
272
269
|
{ issueType: 'infra' },
|
|
270
|
+
{ status: { $ne: 'closed' } },
|
|
273
271
|
{ 'basicDetails.clientId': { $in: req.body.clientId } },
|
|
274
272
|
{ 'ticketDetails.issueStatus': 'identified' },
|
|
275
273
|
{ createdAt: { $gte: date.start } },
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export async function createTicket() {
|
|
4
|
+
try {
|
|
5
|
+
let ticketExist = await findOneTangoTicket( { 'issueType': req.body.issueType, 'basicDetails.storeId': req.body.storeId } );
|
|
6
|
+
|
|
7
|
+
if ( ticketExist ) {
|
|
8
|
+
return res.sendSuccess( 'MAT Ticket Already Exists for the store' );
|
|
9
|
+
}
|
|
10
|
+
} catch ( error ) {
|
|
11
|
+
logger.error( { error: error, function: 'createTicket Data Mismatch' } );
|
|
12
|
+
return res.sendError( error, 500 );
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -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 );
|
|
@@ -211,7 +211,6 @@ export async function userTicketList( req, res ) {
|
|
|
211
211
|
} );
|
|
212
212
|
}
|
|
213
213
|
let ticketList = await aggregateTangoTicket( query );
|
|
214
|
-
console.log( ticketList );
|
|
215
214
|
if ( req.body.export ) {
|
|
216
215
|
const exportdata = [];
|
|
217
216
|
ticketList.forEach( ( element ) => {
|
|
@@ -374,6 +373,7 @@ export async function workHistory( req, res ) {
|
|
|
374
373
|
issueClosedDate: { $dateToString: { format: '%Y-%m-%d', date: '$issueClosedDate' } },
|
|
375
374
|
issueIdentifiedDate: { $dateToString: { format: '%Y-%m-%d', date: '$ticketDetails.issueIdentifiedDate' } },
|
|
376
375
|
ticketId: 1,
|
|
376
|
+
status: 1,
|
|
377
377
|
issueStatus: '$ticketDetails.issueStatus',
|
|
378
378
|
ticketType: '$ticketDetails.ticketType',
|
|
379
379
|
primaryIssue: {
|
|
@@ -456,7 +456,7 @@ export async function workHistory( req, res ) {
|
|
|
456
456
|
'ISSUE IDENTIFIED DATE': element.issueIdentifiedDate,
|
|
457
457
|
'CLOSED ON': element.issueClosedDate,
|
|
458
458
|
'ISSUE': element.infraIssue?element.infraIssue:'-',
|
|
459
|
-
|
|
459
|
+
'STATUS': element.status,
|
|
460
460
|
} );
|
|
461
461
|
} );
|
|
462
462
|
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 ) {
|