tango-app-api-infra 3.1.34-beta.3 → 3.1.34-beta.31
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 +3 -3
- package/src/controllers/clientInfra.controller.js +64 -42
- package/src/controllers/dataMismatch.controller.js +109 -3
- package/src/controllers/infra.controllers.js +212 -29
- package/src/controllers/internalInfra.controller.js +315 -124
- package/src/controllers/storeInfra.controlller.js +1 -1
- package/src/controllers/userInfra.controller.js +31 -6
- package/src/hbs/dailyInfraReport.hbs +665 -299
- package/src/routes/clientInfra.routes.js +11 -39
- package/src/routes/dataMismatch.routes.js +10 -19
- package/src/routes/employeetrainig.routes.js +4 -14
- package/src/routes/infra.routes.js +25 -81
- package/src/routes/storeInfra.routes.js +8 -30
- package/src/services/lowcountReason.service.js +11 -0
- package/src/services/mailonlyusers.service.js +21 -0
- package/src/validations/infra.validation.js +16 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-infra",
|
|
3
|
-
"version": "3.1.34-beta.
|
|
3
|
+
"version": "3.1.34-beta.31",
|
|
4
4
|
"description": "infra",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"mongodb": "^6.4.0",
|
|
27
27
|
"nodemon": "^3.1.0",
|
|
28
28
|
"swagger-ui-express": "^5.0.0",
|
|
29
|
-
"tango-api-schema": "^2.
|
|
30
|
-
"tango-app-api-middleware": "^3.1.
|
|
29
|
+
"tango-api-schema": "^2.1.30",
|
|
30
|
+
"tango-app-api-middleware": "^3.1.43-alpha.5",
|
|
31
31
|
"winston": "^3.12.0",
|
|
32
32
|
"winston-daily-rotate-file": "^5.0.0"
|
|
33
33
|
},
|
|
@@ -13,8 +13,8 @@ export async function infraCard( req, res ) {
|
|
|
13
13
|
try {
|
|
14
14
|
let date = await getUTC( new Date( req.body.fromDate ), new Date( req.body.toDate ) );
|
|
15
15
|
let storecountQuery ={ 'clientId': { $in: req.body.clientId }, 'createdAt': { $lte: date.end }, 'status': 'active' };
|
|
16
|
-
if ( req.body.
|
|
17
|
-
storecountQuery = { ...storecountQuery, ...{ storeId: { $in: req.body.
|
|
16
|
+
if ( req.body.assignedStores && req.body.assignedStores.length > 0 ) {
|
|
17
|
+
storecountQuery = { ...storecountQuery, ...{ storeId: { $in: req.body.assignedStores } } };
|
|
18
18
|
}
|
|
19
19
|
let storeCount = await countDocumentsStore( storecountQuery );
|
|
20
20
|
let yetToInstallQuery = [
|
|
@@ -30,11 +30,11 @@ export async function infraCard( req, res ) {
|
|
|
30
30
|
},
|
|
31
31
|
];
|
|
32
32
|
|
|
33
|
-
if ( req.body.
|
|
33
|
+
if ( req.body.assignedStores && req.body.assignedStores.length > 0 ) {
|
|
34
34
|
yetToInstallQuery.push(
|
|
35
35
|
{
|
|
36
36
|
$match: {
|
|
37
|
-
'basicDetails.storeId': { $in: req.body.
|
|
37
|
+
'basicDetails.storeId': { $in: req.body.assignedStores },
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
40
|
);
|
|
@@ -50,11 +50,11 @@ export async function infraCard( req, res ) {
|
|
|
50
50
|
],
|
|
51
51
|
},
|
|
52
52
|
} ];
|
|
53
|
-
if ( req.body.
|
|
53
|
+
if ( req.body.assignedStores && req.body.assignedStores.length > 0 ) {
|
|
54
54
|
totalStoreQuery.push(
|
|
55
55
|
{
|
|
56
56
|
$match: {
|
|
57
|
-
'storeId': { $in: req.body.
|
|
57
|
+
'storeId': { $in: req.body.assignedStores },
|
|
58
58
|
},
|
|
59
59
|
},
|
|
60
60
|
);
|
|
@@ -227,13 +227,20 @@ export async function installationCard( req, res ) {
|
|
|
227
227
|
clientId: { $in: req.body.clientId },
|
|
228
228
|
createdAt: { $lte: date.end },
|
|
229
229
|
};
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
console.log( req.body.assignedStores );
|
|
231
|
+
console.log( req.storeIds );
|
|
232
|
+
console.log( '-->', req.body.assignedStores );
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
if ( req.body.assignedStores && req.body.assignedStores.length > 0 ) {
|
|
236
|
+
console.log( req.body.assignedStores );
|
|
237
|
+
baseQuery = { ...baseQuery, ...{ storeId: { $in: req.body.assignedStores } } };
|
|
232
238
|
}
|
|
233
239
|
let onboardQuery = { ...baseQuery };
|
|
234
240
|
let installedQuery = { ...baseQuery, status: 'active' };
|
|
235
241
|
let deactiveQuery = { ...baseQuery, status: 'deactive' };
|
|
236
242
|
let onboardedCount = await countDocumentsStore( onboardQuery );
|
|
243
|
+
console.log( onboardedCount );
|
|
237
244
|
let installedCount = await countDocumentsStore( installedQuery );
|
|
238
245
|
let deactiveCount = await countDocumentsStore( deactiveQuery );
|
|
239
246
|
|
|
@@ -250,11 +257,11 @@ export async function installationCard( req, res ) {
|
|
|
250
257
|
},
|
|
251
258
|
},
|
|
252
259
|
];
|
|
253
|
-
if ( req.body.
|
|
260
|
+
if ( req.body.assignedStores && req.body.assignedStores.length > 0 ) {
|
|
254
261
|
ticketbaseQuery.push(
|
|
255
262
|
{
|
|
256
263
|
$match: {
|
|
257
|
-
'basicDetails.storeId': { $in: req.body.
|
|
264
|
+
'basicDetails.storeId': { $in: req.body.assignedStores },
|
|
258
265
|
},
|
|
259
266
|
},
|
|
260
267
|
);
|
|
@@ -367,11 +374,11 @@ export async function infraIssuesTable( req, res ) {
|
|
|
367
374
|
],
|
|
368
375
|
},
|
|
369
376
|
} ];
|
|
370
|
-
if ( req.body.
|
|
377
|
+
if ( req.body.assignedStores && req.body.assignedStores.length > 0 ) {
|
|
371
378
|
totalStoreQuery.push(
|
|
372
379
|
{
|
|
373
380
|
$match: {
|
|
374
|
-
'storeId': { $in: req.body.
|
|
381
|
+
'storeId': { $in: req.body.assignedStores },
|
|
375
382
|
},
|
|
376
383
|
},
|
|
377
384
|
);
|
|
@@ -392,11 +399,11 @@ export async function infraIssuesTable( req, res ) {
|
|
|
392
399
|
],
|
|
393
400
|
},
|
|
394
401
|
} );
|
|
395
|
-
if ( req.body.
|
|
402
|
+
if ( req.body.assignedStores && req.body.assignedStores.length > 0 ) {
|
|
396
403
|
pendingquery.push(
|
|
397
404
|
{
|
|
398
405
|
$match: {
|
|
399
|
-
'basicDetails.storeId': { $in: req.body.
|
|
406
|
+
'basicDetails.storeId': { $in: req.body.assignedStores },
|
|
400
407
|
},
|
|
401
408
|
},
|
|
402
409
|
);
|
|
@@ -538,11 +545,11 @@ export async function infraIssuesTable( req, res ) {
|
|
|
538
545
|
} ];
|
|
539
546
|
}
|
|
540
547
|
}
|
|
541
|
-
if ( req.body.
|
|
548
|
+
if ( req.body.assignedStores && req.body.assignedStores.length > 0 ) {
|
|
542
549
|
storesQuery.push(
|
|
543
550
|
{
|
|
544
551
|
$match: {
|
|
545
|
-
'storeId': { $in: req.body.
|
|
552
|
+
'storeId': { $in: req.body.assignedStores },
|
|
546
553
|
},
|
|
547
554
|
},
|
|
548
555
|
);
|
|
@@ -706,11 +713,11 @@ export async function InstallationIssuesTable( req, res ) {
|
|
|
706
713
|
],
|
|
707
714
|
},
|
|
708
715
|
} );
|
|
709
|
-
if ( req.body.
|
|
716
|
+
if ( req.body.assignedStores && req.body.assignedStores.length > 0 ) {
|
|
710
717
|
query.push(
|
|
711
718
|
{
|
|
712
719
|
$match: {
|
|
713
|
-
'basicDetails.storeId': { $in: req.body.
|
|
720
|
+
'basicDetails.storeId': { $in: req.body.assignedStores },
|
|
714
721
|
},
|
|
715
722
|
},
|
|
716
723
|
);
|
|
@@ -774,11 +781,11 @@ export async function InstallationIssuesTable( req, res ) {
|
|
|
774
781
|
},
|
|
775
782
|
);
|
|
776
783
|
let storesQuery = [];
|
|
777
|
-
if ( req.body.
|
|
784
|
+
if ( req.body.assignedStores && req.body.assignedStores.length > 0 ) {
|
|
778
785
|
storesQuery.push(
|
|
779
786
|
{
|
|
780
787
|
$match: {
|
|
781
|
-
'storeId': { $in: req.body.
|
|
788
|
+
'storeId': { $in: req.body.assignedStores },
|
|
782
789
|
},
|
|
783
790
|
},
|
|
784
791
|
);
|
|
@@ -857,6 +864,7 @@ export async function InstallationIssuesTable( req, res ) {
|
|
|
857
864
|
clientId: 1,
|
|
858
865
|
storeName: 1,
|
|
859
866
|
status: 1,
|
|
867
|
+
firstFileDate: { $ifNull: [ '$edge.firstFileDate', '' ] },
|
|
860
868
|
},
|
|
861
869
|
},
|
|
862
870
|
);
|
|
@@ -926,16 +934,30 @@ export async function InstallationIssuesTable( req, res ) {
|
|
|
926
934
|
}
|
|
927
935
|
if ( req.body.export ) {
|
|
928
936
|
const exportdata = [];
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
937
|
+
if ( req.body.installtionfilterIssue != 'installedStores' ) {
|
|
938
|
+
storesList.forEach( ( element ) => {
|
|
939
|
+
exportdata.push( {
|
|
940
|
+
'Brand Name': element.clientName,
|
|
941
|
+
'Store ID': element.storeId,
|
|
942
|
+
'Store Name': element.storeName,
|
|
943
|
+
'Status': element.status,
|
|
944
|
+
} );
|
|
935
945
|
} );
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
946
|
+
await download( exportdata, res );
|
|
947
|
+
return;
|
|
948
|
+
} else if ( req.body.installtionfilterIssue == 'installedStores' ) {
|
|
949
|
+
storesList.forEach( ( element ) => {
|
|
950
|
+
exportdata.push( {
|
|
951
|
+
'Brand Name': element.clientName,
|
|
952
|
+
'Store ID': element.storeId,
|
|
953
|
+
'Store Name': element.storeName,
|
|
954
|
+
'DeployedDate': element.firstFileDate ? dayjs( element.firstFileDate ).format( 'DD MMM, YYYY' ) : '',
|
|
955
|
+
'Status': element.status,
|
|
956
|
+
} );
|
|
957
|
+
} );
|
|
958
|
+
await download( exportdata, res );
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
939
961
|
}
|
|
940
962
|
res.sendSuccess( {
|
|
941
963
|
count: count.length,
|
|
@@ -1121,11 +1143,11 @@ export async function hourWiseDownstores( req, res ) {
|
|
|
1121
1143
|
],
|
|
1122
1144
|
},
|
|
1123
1145
|
} ];
|
|
1124
|
-
if ( req.body.
|
|
1146
|
+
if ( req.body.assignedStores && req.body.assignedStores.length > 0 ) {
|
|
1125
1147
|
totalStoreQuery.push(
|
|
1126
1148
|
{
|
|
1127
1149
|
$match: {
|
|
1128
|
-
'storeId': { $in: req.body.
|
|
1150
|
+
'storeId': { $in: req.body.assignedStores },
|
|
1129
1151
|
},
|
|
1130
1152
|
},
|
|
1131
1153
|
);
|
|
@@ -1146,11 +1168,11 @@ export async function hourWiseDownstores( req, res ) {
|
|
|
1146
1168
|
],
|
|
1147
1169
|
},
|
|
1148
1170
|
} );
|
|
1149
|
-
if ( req.body.
|
|
1171
|
+
if ( req.body.assignedStores && req.body.assignedStores.length > 0 ) {
|
|
1150
1172
|
pendingquery.push(
|
|
1151
1173
|
{
|
|
1152
1174
|
$match: {
|
|
1153
|
-
'basicDetails.storeId': { $in: req.body.
|
|
1175
|
+
'basicDetails.storeId': { $in: req.body.assignedStores },
|
|
1154
1176
|
},
|
|
1155
1177
|
},
|
|
1156
1178
|
);
|
|
@@ -1291,11 +1313,11 @@ export async function hourWiseDownstores( req, res ) {
|
|
|
1291
1313
|
} ];
|
|
1292
1314
|
}
|
|
1293
1315
|
}
|
|
1294
|
-
if ( req.body.
|
|
1316
|
+
if ( req.body.assignedStores && req.body.assignedStores.length > 0 ) {
|
|
1295
1317
|
storesQuery.push(
|
|
1296
1318
|
{
|
|
1297
1319
|
$match: {
|
|
1298
|
-
'storeId': { $in: req.body.
|
|
1320
|
+
'storeId': { $in: req.body.assignedStores },
|
|
1299
1321
|
},
|
|
1300
1322
|
},
|
|
1301
1323
|
);
|
|
@@ -1500,8 +1522,8 @@ export async function ticketCountSplit( req, res ) {
|
|
|
1500
1522
|
{ issueType: { $in: [ 'highcount', 'lowcount' ] } },
|
|
1501
1523
|
|
|
1502
1524
|
];
|
|
1503
|
-
if ( req.body.
|
|
1504
|
-
filter.push( { 'basicDetails.storeId': { $in: req.body.
|
|
1525
|
+
if ( req.body.assignedStores && req.body.assignedStores.length > 0 ) {
|
|
1526
|
+
filter.push( { 'basicDetails.storeId': { $in: req.body.assignedStores } } );
|
|
1505
1527
|
}
|
|
1506
1528
|
if ( req.user.userType === 'client' ) {
|
|
1507
1529
|
filter.push( { 'dataMismatch.showToClient': true } );
|
|
@@ -1581,8 +1603,8 @@ export async function overViewTable( req, res ) {
|
|
|
1581
1603
|
'basicDetails.clientId': { $in: inputData.clientId },
|
|
1582
1604
|
},
|
|
1583
1605
|
];
|
|
1584
|
-
if ( req.body.
|
|
1585
|
-
filter.push( { 'basicDetails.storeId': { $in: req.body.
|
|
1606
|
+
if ( req.body.assignedStores && req.body.assignedStores.length > 0 ) {
|
|
1607
|
+
filter.push( { 'basicDetails.storeId': { $in: req.body.assignedStores } } );
|
|
1586
1608
|
}
|
|
1587
1609
|
if ( req.user.userType === 'client' ) {
|
|
1588
1610
|
filter.push( { 'dataMismatch.showToClient': true } );
|
|
@@ -1679,8 +1701,8 @@ export async function ticketCount( req, res ) {
|
|
|
1679
1701
|
},
|
|
1680
1702
|
|
|
1681
1703
|
];
|
|
1682
|
-
if ( req.body.
|
|
1683
|
-
filter.push( { 'basicDetails.storeId': { $in: req.body.
|
|
1704
|
+
if ( req.body.assignedStores && req.body.assignedStores.length > 0 ) {
|
|
1705
|
+
filter.push( { 'basicDetails.storeId': { $in: req.body.assignedStores } } );
|
|
1684
1706
|
}
|
|
1685
1707
|
if ( req.user.userType === 'client' ) {
|
|
1686
1708
|
filter.push( { 'dataMismatch.showToClient': true } );
|
|
@@ -1839,7 +1861,7 @@ export async function checkPermission( req, res, next ) {
|
|
|
1839
1861
|
}
|
|
1840
1862
|
if ( result&&result.length>0 ) {
|
|
1841
1863
|
const uniqueArray = [ ...new Set( result[0].storeList ) ];
|
|
1842
|
-
req.body.
|
|
1864
|
+
req.body.assignedStores =uniqueArray;
|
|
1843
1865
|
}
|
|
1844
1866
|
}
|
|
1845
1867
|
next();
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { findOneTangoTicket, createTangoTicket, updateOneTangoTicket, aggregateTangoTicket, countDocumentsTangoTicket, findTangoTicket } from '../services/tangoTicket.service.js';
|
|
3
3
|
import { logger, getUTC, fileUpload, signedUrl, sendMessageToQueue, listFileByPath } from 'tango-app-api-middleware';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
|
+
import { findlowcountReason } from '../services/lowcountReason.service.js';
|
|
5
6
|
|
|
6
7
|
export async function createTicket( req, res ) {
|
|
7
8
|
try {
|
|
@@ -25,7 +26,7 @@ export async function createTicket( req, res ) {
|
|
|
25
26
|
);
|
|
26
27
|
|
|
27
28
|
|
|
28
|
-
if ( clientTickets.length >
|
|
29
|
+
if ( clientTickets.length > 100 ) {
|
|
29
30
|
return res.sendError( 'Ticket limit exceeded for the day', 400 );
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -36,13 +37,33 @@ export async function createTicket( req, res ) {
|
|
|
36
37
|
MaxKeys: 1,
|
|
37
38
|
};
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
let auditInputData = await listFileByPath( param );
|
|
41
|
+
|
|
42
|
+
if ( !auditInputData?.data?.length ) {
|
|
43
|
+
param.file_path = `${dayjs( new Date( req.body.Date ) ).format( 'DD-MM-YYYY' )}/${req.body.storeId}/traffic_zone/`;
|
|
44
|
+
auditInputData = await listFileByPath( param );
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if ( !auditInputData?.data?.length ) {
|
|
48
|
+
param.file_path = `${dayjs( new Date( req.body.Date ) ).format( 'DD-MM-YYYY' )}/${req.body.storeId}/traffic/`;
|
|
49
|
+
auditInputData = await listFileByPath( param );
|
|
50
|
+
}
|
|
40
51
|
|
|
41
52
|
param.Bucket = JSON.parse( process.env.BUCKET ).auditOutput;
|
|
42
53
|
|
|
43
54
|
param.file_path = `${req.body.storeId}/${dayjs( new Date( req.body.Date ) ).format( 'DD-MM-YYYY' )}/`;
|
|
44
55
|
|
|
45
|
-
|
|
56
|
+
let auditOutputData = await listFileByPath( param );
|
|
57
|
+
|
|
58
|
+
if ( !auditOutputData?.data?.length ) {
|
|
59
|
+
param.file_path = `${req.body.storeId}/traffic_zone/${dayjs( new Date( req.body.Date ) ).format( 'DD-MM-YYYY' )}/`;
|
|
60
|
+
auditOutputData = await listFileByPath( param );
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if ( !auditOutputData?.data?.length ) {
|
|
64
|
+
param.file_path = `${req.body.storeId}/traffic/${dayjs( new Date( req.body.Date ) ).format( 'DD-MM-YYYY' )}/`;
|
|
65
|
+
auditOutputData = await listFileByPath( param );
|
|
66
|
+
}
|
|
46
67
|
|
|
47
68
|
|
|
48
69
|
if ( req.body.issueType === 'highcount' ) {
|
|
@@ -327,9 +348,94 @@ export async function showActivity( req, res ) {
|
|
|
327
348
|
}
|
|
328
349
|
}
|
|
329
350
|
}
|
|
351
|
+
if ( req.body.allAttachments && req.body.allAttachments.length > 0 ) {
|
|
352
|
+
for ( let index in req.body.allAttachments ) {
|
|
353
|
+
if ( req.body.allAttachments.hasOwnProperty( index ) ) {
|
|
354
|
+
let file = req.body.allAttachments[index];
|
|
355
|
+
let params = {
|
|
356
|
+
Bucket: JSON.parse( process.env.BUCKET ).ticket,
|
|
357
|
+
file_path: file.filePath,
|
|
358
|
+
};
|
|
359
|
+
let attachments = await signedUrl( params );
|
|
360
|
+
req.body.allAttachments[index].signedUrl = attachments;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
req.body.attachments = req.body.allAttachments;
|
|
364
|
+
delete req.body.allAttachments;
|
|
365
|
+
}
|
|
330
366
|
res.sendSuccess( req.body );
|
|
331
367
|
} catch ( error ) {
|
|
332
368
|
logger.error( { error: error, function: 'showActivity' } );
|
|
333
369
|
return res.sendError( error, 500 );
|
|
334
370
|
}
|
|
335
371
|
}
|
|
372
|
+
|
|
373
|
+
export async function secondaryReason( req, res ) {
|
|
374
|
+
try {
|
|
375
|
+
let list = await findlowcountReason( { parentName: req.body.primaryIssue }, { name: 1, order: 1, toolTips: 1 } );
|
|
376
|
+
if ( list.length > 0 ) {
|
|
377
|
+
res.sendSuccess( {
|
|
378
|
+
count: list.length,
|
|
379
|
+
result: list,
|
|
380
|
+
} );
|
|
381
|
+
} else {
|
|
382
|
+
res.sendError( 'No data found', 204 );
|
|
383
|
+
}
|
|
384
|
+
} catch ( error ) {
|
|
385
|
+
logger.error( { error: error, function: 'secondaryReason' } );
|
|
386
|
+
return res.sendError( error, 500 );
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
export async function updateTicketIssue( req, res ) {
|
|
391
|
+
try {
|
|
392
|
+
if ( req.body.comment != '' && !req.body.secondary || req.body.secondary.length == 0 ) {
|
|
393
|
+
let actionBy = '';
|
|
394
|
+
if ( req.user.userType == 'tango' ) {
|
|
395
|
+
actionBy = 'Tango';
|
|
396
|
+
} else if ( req.user.userType == 'client' ) {
|
|
397
|
+
actionBy = 'User';
|
|
398
|
+
}
|
|
399
|
+
if ( req.body.comment != '' ) {
|
|
400
|
+
req.body.ticketActivity.push( {
|
|
401
|
+
actionType: 'comment',
|
|
402
|
+
actionBy: actionBy,
|
|
403
|
+
timeStamp: new Date(),
|
|
404
|
+
IdentifiedBy: req.user.userName,
|
|
405
|
+
comment: req.body.comment,
|
|
406
|
+
} );
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
let query = {};
|
|
410
|
+
if ( req.user.userType == 'client' ) {
|
|
411
|
+
query = {
|
|
412
|
+
'ticketActivity': req.body.ticketActivity,
|
|
413
|
+
'cameraList': req.body.cameraList,
|
|
414
|
+
'ticketDetails.issueIdentifiedDate': new Date(),
|
|
415
|
+
'ticketDetails.issueIdentifiedBy': req.body.issueIdentifiedBy,
|
|
416
|
+
'ticketDetails.addressingClient': req.user._id,
|
|
417
|
+
'ticketDetails.issueStatus': 'identified',
|
|
418
|
+
'status': 'inprogress',
|
|
419
|
+
};
|
|
420
|
+
} else {
|
|
421
|
+
query = {
|
|
422
|
+
'ticketActivity': req.body.ticketActivity,
|
|
423
|
+
'cameraList': req.body.cameraList,
|
|
424
|
+
'ticketDetails.issueIdentifiedDate': new Date(),
|
|
425
|
+
'ticketDetails.issueIdentifiedBy': req.body.issueIdentifiedBy,
|
|
426
|
+
'ticketDetails.addressingUser': req.user._id,
|
|
427
|
+
'ticketDetails.issueStatus': 'identified',
|
|
428
|
+
'status': 'inprogress',
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
let updateTicket = await updateOneTangoTicket( { ticketId: req.body.ticketId }, query );
|
|
433
|
+
|
|
434
|
+
if ( updateTicket ) {
|
|
435
|
+
res.sendSuccess( 'Ticket Updated Successfully' );
|
|
436
|
+
}
|
|
437
|
+
} catch ( error ) {
|
|
438
|
+
logger.error( { error: error, function: 'updateTicketIssue' } );
|
|
439
|
+
return res.sendError( error, 500 );
|
|
440
|
+
}
|
|
441
|
+
}
|