tango-app-api-infra 3.1.10 → 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 +3 -0
- package/src/controllers/dataMismatch.controller.js +14 -0
- package/src/controllers/infra.controllers.js +11 -19
- package/src/controllers/userInfra.controller.js +2 -1
- package/src/routes/dataMismatch.routes.js +10 -0
- package/src/validations/infra.validation.js +2 -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
|
@@ -16,6 +16,7 @@ export async function infraCard( req, res ) {
|
|
|
16
16
|
$match: {
|
|
17
17
|
$and: [
|
|
18
18
|
{ issueType: 'infra' },
|
|
19
|
+
{ status: { $ne: 'closed' } },
|
|
19
20
|
{ 'basicDetails.clientId': { $in: req.body.clientId } },
|
|
20
21
|
{ createdAt: { $gte: date.start } },
|
|
21
22
|
{ createdAt: { $lte: date.end } },
|
|
@@ -50,6 +51,7 @@ export async function infraCard( req, res ) {
|
|
|
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
57
|
{ createdAt: { $gte: date.start } },
|
|
@@ -265,6 +267,7 @@ export async function infraIssuesTable( req, res ) {
|
|
|
265
267
|
$match: {
|
|
266
268
|
$and: [
|
|
267
269
|
{ issueType: 'infra' },
|
|
270
|
+
{ status: { $ne: 'closed' } },
|
|
268
271
|
{ 'basicDetails.clientId': { $in: req.body.clientId } },
|
|
269
272
|
{ 'ticketDetails.issueStatus': 'identified' },
|
|
270
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
|
+
}
|
|
@@ -725,7 +725,7 @@ export async function infraTable( req, res ) {
|
|
|
725
725
|
},
|
|
726
726
|
{
|
|
727
727
|
$group: {
|
|
728
|
-
_id: '$
|
|
728
|
+
_id: '$ticketId',
|
|
729
729
|
storeId: { $first: '$storeId' },
|
|
730
730
|
clientId: { $first: '$clientId' },
|
|
731
731
|
ticketId: { $first: '$ticketId' },
|
|
@@ -847,15 +847,11 @@ export async function infraTable( req, res ) {
|
|
|
847
847
|
await download( exportdata, res );
|
|
848
848
|
return;
|
|
849
849
|
}
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
} );
|
|
856
|
-
} else {
|
|
857
|
-
res.sendError( 'no data', 204 );
|
|
858
|
-
}
|
|
850
|
+
res.sendSuccess( {
|
|
851
|
+
response: response,
|
|
852
|
+
count: count.length,
|
|
853
|
+
result: result,
|
|
854
|
+
} );
|
|
859
855
|
} catch ( error ) {
|
|
860
856
|
logger.error( { error: error, function: 'infraTable' } );
|
|
861
857
|
return res.sendError( error, 500 );
|
|
@@ -1088,15 +1084,11 @@ export async function installationTable( req, res ) {
|
|
|
1088
1084
|
await download( exportdata, res );
|
|
1089
1085
|
return;
|
|
1090
1086
|
}
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
} );
|
|
1097
|
-
} else {
|
|
1098
|
-
res.sendError( 'no data', 204 );
|
|
1099
|
-
}
|
|
1087
|
+
res.sendSuccess( {
|
|
1088
|
+
response: response,
|
|
1089
|
+
count: count.length,
|
|
1090
|
+
result: result,
|
|
1091
|
+
} );
|
|
1100
1092
|
} catch ( error ) {
|
|
1101
1093
|
logger.error( { error: error, function: 'installationTable' } );
|
|
1102
1094
|
return res.sendError( error, 500 );
|
|
@@ -373,6 +373,7 @@ export async function workHistory( req, res ) {
|
|
|
373
373
|
issueClosedDate: { $dateToString: { format: '%Y-%m-%d', date: '$issueClosedDate' } },
|
|
374
374
|
issueIdentifiedDate: { $dateToString: { format: '%Y-%m-%d', date: '$ticketDetails.issueIdentifiedDate' } },
|
|
375
375
|
ticketId: 1,
|
|
376
|
+
status: 1,
|
|
376
377
|
issueStatus: '$ticketDetails.issueStatus',
|
|
377
378
|
ticketType: '$ticketDetails.ticketType',
|
|
378
379
|
primaryIssue: {
|
|
@@ -455,7 +456,7 @@ export async function workHistory( req, res ) {
|
|
|
455
456
|
'ISSUE IDENTIFIED DATE': element.issueIdentifiedDate,
|
|
456
457
|
'CLOSED ON': element.issueClosedDate,
|
|
457
458
|
'ISSUE': element.infraIssue?element.infraIssue:'-',
|
|
458
|
-
|
|
459
|
+
'STATUS': element.status,
|
|
459
460
|
} );
|
|
460
461
|
} );
|
|
461
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 );
|
|
@@ -185,6 +185,8 @@ export async function ticketExists( req, res, next ) {
|
|
|
185
185
|
req.body.ticketDetails = Ticket.ticketDetails;
|
|
186
186
|
req.body.ticketActivity = Ticket.ticketActivity;
|
|
187
187
|
req.body.status = Ticket.status;
|
|
188
|
+
req.body.issueDate = Ticket.issueDate;
|
|
189
|
+
|
|
188
190
|
|
|
189
191
|
next();
|
|
190
192
|
} catch ( error ) {
|