tango-app-api-infra 3.0.28-dev → 3.0.30-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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-infra",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.30-dev",
|
|
4
4
|
"description": "infra",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"handlebars": "^4.7.8",
|
|
23
23
|
"mongodb": "^6.4.0",
|
|
24
24
|
"nodemon": "^3.1.0",
|
|
25
|
-
"tango-api-schema": "^2.0.
|
|
25
|
+
"tango-api-schema": "^2.0.65",
|
|
26
26
|
"tango-app-api-middleware": "^1.0.49-dev",
|
|
27
27
|
"winston": "^3.12.0",
|
|
28
28
|
"winston-daily-rotate-file": "^5.0.0"
|
|
@@ -62,15 +62,30 @@ export async function bulkcreateTicket( req, res ) {
|
|
|
62
62
|
|
|
63
63
|
export async function updateStatus( req, res ) {
|
|
64
64
|
try {
|
|
65
|
-
if ( req.
|
|
66
|
-
req.body.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
65
|
+
if ( req.user.userType == 'tango' ) {
|
|
66
|
+
if ( req.body.status == 'inprogress' ) {
|
|
67
|
+
req.body.ticketActivity.push( {
|
|
68
|
+
actionType: 'statusChange',
|
|
69
|
+
actionBy: 'Tango',
|
|
70
|
+
} );
|
|
71
|
+
}
|
|
72
|
+
req.body.ticketDetails.addressingUser = req.user._id;
|
|
73
|
+
let updateTicket = await updateOneTangoTicket( { ticketId: req.body.ticketId }, req.body );
|
|
74
|
+
if ( updateTicket ) {
|
|
75
|
+
res.sendSuccess( 'Ticket Updated Successfully' );
|
|
76
|
+
}
|
|
77
|
+
} else if ( req.user.userType == 'client' ) {
|
|
78
|
+
if ( req.body.status == 'inprogress' ) {
|
|
79
|
+
req.body.ticketActivity.push( {
|
|
80
|
+
actionType: 'statusChange',
|
|
81
|
+
actionBy: 'User',
|
|
82
|
+
} );
|
|
83
|
+
}
|
|
84
|
+
req.body.ticketDetails.addressingClient = req.user._id;
|
|
85
|
+
let updateTicket = await updateOneTangoTicket( { ticketId: req.body.ticketId }, req.body );
|
|
86
|
+
if ( updateTicket ) {
|
|
87
|
+
res.sendSuccess( 'Ticket Updated Successfully' );
|
|
88
|
+
}
|
|
74
89
|
}
|
|
75
90
|
} catch ( error ) {
|
|
76
91
|
logger.error( { error: error, function: 'updateStatus' } );
|
|
@@ -116,7 +116,7 @@ export async function downStoresList( req, res ) {
|
|
|
116
116
|
}
|
|
117
117
|
export async function openTicketList( req, res ) {
|
|
118
118
|
try {
|
|
119
|
-
let openTicketList = await findTangoTicket( { status: { $ne: 'closed' }
|
|
119
|
+
let openTicketList = await findTangoTicket( { status: { $ne: 'closed' } }, { ticketId: 1, basicDetails: 1, createdAt: 1, updateAt: 1, ticketDetails: 1 } );
|
|
120
120
|
if ( openTicketList.length ) {
|
|
121
121
|
res.sendSuccess( {
|
|
122
122
|
count: openTicketList.length,
|
|
@@ -12,9 +12,15 @@ export async function userTakeTicket( req, res ) {
|
|
|
12
12
|
try {
|
|
13
13
|
let userTicket = '';
|
|
14
14
|
if ( req.body.issueType == 'infra' ) {
|
|
15
|
-
userTicket = await findOneTangoTicket( { 'status': { $ne: 'closed' }, 'issueType': 'infra', 'ticketDetails.assigntoUser': true, 'ticketDetails.addressingUser': { $exists: false } } );
|
|
15
|
+
userTicket = await findOneTangoTicket( { 'status': { $ne: 'closed' }, 'issueType': 'infra', 'ticketDetails.assigntoUser': true, 'ticketDetails.addressingUser': { $exists: false }, 'ticketDetails.issueStatus': 'notidentified', 'ticketDetails.addressingClient': { $exists: false } } );
|
|
16
|
+
if ( !userTicket ) {
|
|
17
|
+
userTicket = await findOneTangoTicket( { 'status': { $ne: 'closed' }, 'issueType': 'infra', 'ticketType': 'refreshticket', 'ticketDetails.refreshTicketStatus': 'notidentified' } );
|
|
18
|
+
}
|
|
16
19
|
} else if ( req.body.issueType == 'installation' ) {
|
|
17
|
-
userTicket = await findOneTangoTicket( { 'status': { $ne: 'closed' }, 'issueType': 'installation', 'ticketDetails.addressingUser': { $exists: false } } );
|
|
20
|
+
userTicket = await findOneTangoTicket( { 'status': { $ne: 'closed' }, 'issueType': 'installation', 'ticketDetails.addressingUser': { $exists: false }, 'ticketDetails.issueStatus': 'notidentified', 'ticketDetails.addressingClient': { $exists: false } } );
|
|
21
|
+
if ( !userTicket ) {
|
|
22
|
+
userTicket = await findOneTangoTicket( { 'status': { $ne: 'closed' }, 'issueType': 'installation', 'ticketType': 'refreshticket', 'ticketDetails.refreshTicketStatus': 'notidentified' } );
|
|
23
|
+
}
|
|
18
24
|
}
|
|
19
25
|
if ( userTicket ) {
|
|
20
26
|
let assignTicket = await updateOneTangoTicket( { ticketId: userTicket.ticketId }, { 'ticketDetails.addressingUser': req.body.userId } );
|
|
@@ -7,27 +7,27 @@ export const clientInfraRouter = express.Router();
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
clientInfraRouter.post( '/infraCard', isAllowedSessionHandler, authorize( {
|
|
10
|
-
userType: [ 'client' ], access: [
|
|
10
|
+
userType: [ 'client', 'tango' ], access: [
|
|
11
11
|
{ featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
|
|
12
12
|
} ), infraCard );
|
|
13
13
|
clientInfraRouter.post( '/infraIssuesTable', isAllowedSessionHandler, authorize( {
|
|
14
|
-
userType: [ 'client' ], access: [
|
|
14
|
+
userType: [ 'client', 'tango' ], access: [
|
|
15
15
|
{ featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
|
|
16
16
|
} ), infraIssuesTable );
|
|
17
17
|
clientInfraRouter.post( '/installationCard', isAllowedSessionHandler, authorize( {
|
|
18
|
-
userType: [ 'client' ], access: [
|
|
18
|
+
userType: [ 'client', 'tango' ], access: [
|
|
19
19
|
{ featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
|
|
20
20
|
} ), installationCard );
|
|
21
21
|
clientInfraRouter.post( '/InstallationIssuesTable', isAllowedSessionHandler, authorize( {
|
|
22
|
-
userType: [ 'client' ], access: [
|
|
22
|
+
userType: [ 'client', 'tango' ], access: [
|
|
23
23
|
{ featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
|
|
24
24
|
} ), InstallationIssuesTable );
|
|
25
25
|
clientInfraRouter.post( '/hourWiseDownClients', isAllowedSessionHandler, authorize( {
|
|
26
|
-
userType: [ 'client' ], access: [
|
|
26
|
+
userType: [ 'client', 'tango' ], access: [
|
|
27
27
|
{ featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
|
|
28
28
|
} ), hourWiseDownClients );
|
|
29
29
|
clientInfraRouter.post( '/hourWiseDownstores', isAllowedSessionHandler, authorize( {
|
|
30
|
-
userType: [ 'client' ], access: [
|
|
30
|
+
userType: [ 'client', 'tango' ], access: [
|
|
31
31
|
{ featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
|
|
32
32
|
} ), hourWiseDownstores );
|
|
33
33
|
|
|
@@ -196,9 +196,15 @@ export async function infraReasonExists( req, res, next ) {
|
|
|
196
196
|
secondaryIsssue: [ ...resolveSteps ],
|
|
197
197
|
} );
|
|
198
198
|
}
|
|
199
|
+
let actionBy = '';
|
|
200
|
+
if ( req.user.userType == 'tango' ) {
|
|
201
|
+
actionBy = 'Tango';
|
|
202
|
+
} else if ( req.user.userType == 'client' ) {
|
|
203
|
+
actionBy = 'User';
|
|
204
|
+
}
|
|
199
205
|
req.body.ticketActivity.push( {
|
|
200
206
|
actionType: 'issueUpdate',
|
|
201
|
-
actionBy:
|
|
207
|
+
actionBy: actionBy,
|
|
202
208
|
comment: req.body.comment,
|
|
203
209
|
reasons: [ {
|
|
204
210
|
primaryIssue: primaryReason.name,
|