tango-app-api-infra 3.0.30-dev → 3.0.32-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.32-dev",
|
|
4
4
|
"description": "infra",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"handlebars": "^4.7.8",
|
|
23
23
|
"mongodb": "^6.4.0",
|
|
24
24
|
"nodemon": "^3.1.0",
|
|
25
|
-
"tango-api-schema": "^2.0.
|
|
26
|
-
"tango-app-api-middleware": "^1.0.
|
|
25
|
+
"tango-api-schema": "^2.0.66",
|
|
26
|
+
"tango-app-api-middleware": "^1.0.51-dev",
|
|
27
27
|
"winston": "^3.12.0",
|
|
28
28
|
"winston-daily-rotate-file": "^5.0.0"
|
|
29
29
|
},
|
|
@@ -133,7 +133,7 @@ export async function storeTicketcard( req, res ) {
|
|
|
133
133
|
{ 'ticketDetails.issueStatus': 'identified' },
|
|
134
134
|
{ issueType: 'infra' },
|
|
135
135
|
{ createdAt: { $gte: date.start } },
|
|
136
|
-
{ createdAt: { $lte: date.
|
|
136
|
+
{ createdAt: { $lte: date.end } },
|
|
137
137
|
],
|
|
138
138
|
|
|
139
139
|
},
|
|
@@ -51,8 +51,8 @@ export async function userTicketList( req, res ) {
|
|
|
51
51
|
query.push( {
|
|
52
52
|
$match: {
|
|
53
53
|
$and: [
|
|
54
|
-
{
|
|
55
|
-
{
|
|
54
|
+
{ updatedAt: { $gte: date.start } },
|
|
55
|
+
{ updatedAt: { $lte: date.end } },
|
|
56
56
|
],
|
|
57
57
|
},
|
|
58
58
|
} );
|
|
@@ -171,47 +171,50 @@ export async function ticketExists( req, res, next ) {
|
|
|
171
171
|
};
|
|
172
172
|
export async function infraReasonExists( req, res, next ) {
|
|
173
173
|
try {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const secondary = [];
|
|
179
|
-
const steptoReslove = [];
|
|
180
|
-
for ( let i = 0; i < req.body.secondary.length; i++ ) {
|
|
181
|
-
let secondaryReason = await findOneinfraReason( { name: req.body.secondary[i] } );
|
|
182
|
-
if ( !secondaryReason ) {
|
|
183
|
-
return res.sendError( `secondary Reason - ${req.body.secondary[i]} Not exists in database`, 500 );
|
|
174
|
+
if ( req.body.primary&&req.body.secondary&&req.body.secondary.length ) {
|
|
175
|
+
let primaryReason = await findOneinfraReason( { name: req.body.primary } );
|
|
176
|
+
if ( !primaryReason ) {
|
|
177
|
+
return res.sendError( 'Primary Reason Not exists in database', 500 );
|
|
184
178
|
}
|
|
185
|
-
secondary
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
179
|
+
const secondary = [];
|
|
180
|
+
const steptoReslove = [];
|
|
181
|
+
for ( let i = 0; i < req.body.secondary.length; i++ ) {
|
|
182
|
+
let secondaryReason = await findOneinfraReason( { name: req.body.secondary[i] } );
|
|
183
|
+
if ( !secondaryReason ) {
|
|
184
|
+
return res.sendError( `secondary Reason - ${req.body.secondary[i]} Not exists in database`, 500 );
|
|
185
|
+
}
|
|
186
|
+
secondary.push( {
|
|
187
|
+
name: secondaryReason.name,
|
|
188
|
+
} );
|
|
189
|
+
let resolveSteps = [];
|
|
190
|
+
for ( let i = 0; i < secondaryReason.stepstoResolve.length; i++ ) {
|
|
191
|
+
resolveSteps.push( {
|
|
192
|
+
name: secondaryReason.stepstoResolve[i].name,
|
|
193
|
+
} );
|
|
194
|
+
}
|
|
195
|
+
steptoReslove.push( {
|
|
196
|
+
primaryIssue: secondaryReason.name,
|
|
197
|
+
secondaryIsssue: [ ...resolveSteps ],
|
|
192
198
|
} );
|
|
193
199
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
} )
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
200
|
+
let actionBy = '';
|
|
201
|
+
if ( req.user.userType == 'tango' ) {
|
|
202
|
+
actionBy = 'Tango';
|
|
203
|
+
} else if ( req.user.userType == 'client' ) {
|
|
204
|
+
actionBy = 'User';
|
|
205
|
+
}
|
|
206
|
+
req.body.ticketActivity.push( {
|
|
207
|
+
actionType: 'issueUpdate',
|
|
208
|
+
actionBy: actionBy,
|
|
209
|
+
comment: req.body.comment,
|
|
210
|
+
reasons: [ {
|
|
211
|
+
primaryIssue: primaryReason.name,
|
|
212
|
+
secondaryIssue: secondary,
|
|
213
|
+
} ],
|
|
214
|
+
},
|
|
215
|
+
);
|
|
204
216
|
}
|
|
205
|
-
|
|
206
|
-
actionType: 'issueUpdate',
|
|
207
|
-
actionBy: actionBy,
|
|
208
|
-
comment: req.body.comment,
|
|
209
|
-
reasons: [ {
|
|
210
|
-
primaryIssue: primaryReason.name,
|
|
211
|
-
secondaryIssue: secondary,
|
|
212
|
-
} ],
|
|
213
|
-
},
|
|
214
|
-
);
|
|
217
|
+
|
|
215
218
|
next();
|
|
216
219
|
} catch ( error ) {
|
|
217
220
|
logger.error( { error: error, function: 'infraReasonExists' } );
|
|
@@ -221,27 +224,29 @@ export async function infraReasonExists( req, res, next ) {
|
|
|
221
224
|
export async function InfrastepstoResolve( req, res, next ) {
|
|
222
225
|
try {
|
|
223
226
|
const steptoReslove = [];
|
|
224
|
-
|
|
225
|
-
let
|
|
226
|
-
|
|
227
|
-
|
|
227
|
+
if ( req.body.primary&&req.body.secondary&&req.body.secondary.length ) {
|
|
228
|
+
for ( let i = 0; i < req.body.secondary.length; i++ ) {
|
|
229
|
+
let secondaryReason = await findOneinfraReason( { name: req.body.secondary[i] } );
|
|
230
|
+
if ( !secondaryReason ) {
|
|
231
|
+
return res.sendError( `secondary Reason - ${req.body.secondary[i]} Not exists in database`, 500 );
|
|
232
|
+
}
|
|
233
|
+
steptoReslove.push( {
|
|
234
|
+
primaryIssue: secondaryReason.name,
|
|
235
|
+
secondaryIsssue: [ ...secondaryReason.stepstoResolve ],
|
|
236
|
+
} );
|
|
228
237
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
reasons: steptoReslove.map( ( item ) => ( {
|
|
239
|
-
primaryIssue: item.primaryIssue,
|
|
240
|
-
secondaryIssue: item.secondaryIsssue.map( ( issue ) => ( {
|
|
241
|
-
name: issue.name, // Assuming each object has a 'name' property
|
|
238
|
+
if ( req.body.primary != 'Store Operation Issues' && req.body.primary != 'Application Issues' ) {
|
|
239
|
+
req.body.ticketActivity.push( {
|
|
240
|
+
actionType: 'stepsToResolve',
|
|
241
|
+
actionBy: 'Tango',
|
|
242
|
+
reasons: steptoReslove.map( ( item ) => ( {
|
|
243
|
+
primaryIssue: item.primaryIssue,
|
|
244
|
+
secondaryIssue: item.secondaryIsssue.map( ( issue ) => ( {
|
|
245
|
+
name: issue.name, // Assuming each object has a 'name' property
|
|
246
|
+
} ) ),
|
|
242
247
|
} ) ),
|
|
243
|
-
} )
|
|
244
|
-
}
|
|
248
|
+
} );
|
|
249
|
+
}
|
|
245
250
|
}
|
|
246
251
|
next();
|
|
247
252
|
} catch ( error ) {
|
|
@@ -264,13 +269,29 @@ export async function InfraAlert( req, res, next ) {
|
|
|
264
269
|
await updateOneTangoTicket( { ticketId: req.body.ticketId }, { 'hibernation': new Date( req.body.hibernationDays ) } );
|
|
265
270
|
} else {
|
|
266
271
|
if ( req.body.issueType == 'infra' ) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
272
|
+
if ( req.body.primary&&req.body.secondary&&req.body.secondary.length ) {
|
|
273
|
+
let client = await findOneClient( { clientId: req.body.basicDetails.clientId }, { ticketConfigs: 1 } );
|
|
274
|
+
let statusCheckAlertTime = dayjs().add( client.ticketConfigs.statusCheckAlert, 'hours' ).format( 'YYYY-MM-DD hh:mm' );
|
|
275
|
+
req.body.ticketActivity.push( {
|
|
276
|
+
actionType: 'statusCheck',
|
|
277
|
+
actionBy: 'Tango',
|
|
278
|
+
statusCheckAlertTime: statusCheckAlertTime,
|
|
279
|
+
} );
|
|
280
|
+
} else {
|
|
281
|
+
if ( req.body.comment !='' ) {
|
|
282
|
+
let actionBy = '';
|
|
283
|
+
if ( req.user.userType == 'tango' ) {
|
|
284
|
+
actionBy = 'Tango';
|
|
285
|
+
} else if ( req.user.userType == 'client' ) {
|
|
286
|
+
actionBy = 'User';
|
|
287
|
+
}
|
|
288
|
+
req.body.ticketActivity.push( {
|
|
289
|
+
actionType: 'comment',
|
|
290
|
+
actionBy: actionBy,
|
|
291
|
+
comment: req.body.comment,
|
|
292
|
+
} );
|
|
293
|
+
}
|
|
294
|
+
}
|
|
274
295
|
}
|
|
275
296
|
}
|
|
276
297
|
|