tango-app-api-task 3.7.2-multireff-1 → 3.7.2-multireff-2
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-task",
|
|
3
|
-
"version": "3.7.2-multireff-
|
|
3
|
+
"version": "3.7.2-multireff-2",
|
|
4
4
|
"description": "Task",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"mongodb": "^6.10.0",
|
|
26
26
|
"nodemon": "^3.1.7",
|
|
27
27
|
"npm": "^10.9.2",
|
|
28
|
-
"tango-api-schema": "^2.2.
|
|
28
|
+
"tango-api-schema": "^2.2.201",
|
|
29
29
|
"tango-app-api-middleware": "^3.1.77",
|
|
30
30
|
"winston": "^3.17.0",
|
|
31
31
|
"winston-daily-rotate-file": "^5.0.0"
|
|
@@ -1232,7 +1232,7 @@ function findObjectDifference( oldObj, newObj ) {
|
|
|
1232
1232
|
}
|
|
1233
1233
|
|
|
1234
1234
|
|
|
1235
|
-
export async function insertSingleProcessData( checklistId, answerTypechange, inputBody ) {
|
|
1235
|
+
export async function insertSingleProcessData( checklistId, answerTypechange, inputBody, insertfrom ) {
|
|
1236
1236
|
try {
|
|
1237
1237
|
let currentdate = new Date();
|
|
1238
1238
|
let date = dayjs( currentdate ).format();
|
|
@@ -1346,7 +1346,7 @@ export async function insertSingleProcessData( checklistId, answerTypechange, in
|
|
|
1346
1346
|
updatedchecklist = checklistDetails;
|
|
1347
1347
|
}
|
|
1348
1348
|
if ( updatedchecklist ) {
|
|
1349
|
-
await insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, dateVal, startTimeIso, endTimeIso, insertdata, answerTypechange, inputBody );
|
|
1349
|
+
await insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, dateVal, startTimeIso, endTimeIso, insertdata, answerTypechange, inputBody, insertfrom );
|
|
1350
1350
|
}
|
|
1351
1351
|
}
|
|
1352
1352
|
}
|
|
@@ -1358,7 +1358,7 @@ export async function insertSingleProcessData( checklistId, answerTypechange, in
|
|
|
1358
1358
|
}
|
|
1359
1359
|
};
|
|
1360
1360
|
|
|
1361
|
-
async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date, startTimeIso, endTimeIso, insertdata, answerTypechange, inputBody ) {
|
|
1361
|
+
async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date, startTimeIso, endTimeIso, insertdata, answerTypechange, inputBody, insertfrom ) {
|
|
1362
1362
|
let getquestionQuery = [];
|
|
1363
1363
|
|
|
1364
1364
|
if ( dayjs( getCLconfig.publishDate ).format( 'YYYY-MM-DD' ) != dayjs( date ).format( 'YYYY-MM-DD' ) ) {
|
|
@@ -1531,10 +1531,20 @@ async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date,
|
|
|
1531
1531
|
if ( inputBody && inputBody?.streamId ) {
|
|
1532
1532
|
element4.streamId = inputBody?.streamId;
|
|
1533
1533
|
}
|
|
1534
|
+
console.log( insertdata.questionAnswers, element4.comments );
|
|
1534
1535
|
if ( answerTypechange ) {
|
|
1535
1536
|
element4.questionAnswers = insertdata.questionAnswers;
|
|
1536
1537
|
element4.planoType = 'qrScan';
|
|
1537
1538
|
}
|
|
1539
|
+
|
|
1540
|
+
if ( insertfrom === 'gallery' ) {
|
|
1541
|
+
// Clone the data to prevent shared reference
|
|
1542
|
+
const clonedQuestionAnswers = JSON.parse( JSON.stringify( insertdata.questionAnswers ) );
|
|
1543
|
+
clonedQuestionAnswers[0].questions[0].qcomment = element4.comments;
|
|
1544
|
+
|
|
1545
|
+
element4.questionAnswers = clonedQuestionAnswers;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1538
1548
|
element4.coverage = getCLconfig?.coverage;
|
|
1539
1549
|
assignUserList.push( element4 );
|
|
1540
1550
|
}
|
|
@@ -1571,6 +1581,8 @@ async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date,
|
|
|
1571
1581
|
item1.store_id === item2.store_id && item1.userEmail === item2.userEmail,
|
|
1572
1582
|
),
|
|
1573
1583
|
);
|
|
1584
|
+
|
|
1585
|
+
|
|
1574
1586
|
await taskProcessedService.insertMany( insertList );
|
|
1575
1587
|
logger.info( { function: 'insertPCBulk_v3', query: assigndeletequery } );
|
|
1576
1588
|
}
|
|
@@ -1623,7 +1635,7 @@ export async function uploadImage( req, res ) {
|
|
|
1623
1635
|
return res.sendError( { message: 'Something went wrong' }, 500 );
|
|
1624
1636
|
}
|
|
1625
1637
|
|
|
1626
|
-
return res.sendSuccess( { message: 'Uploaded Successfully', imgUrl: imgUrl } );
|
|
1638
|
+
return res.sendSuccess( { message: 'Uploaded Successfully', imgUrl: imgUrl, path: inputData.file_path } );
|
|
1627
1639
|
} catch ( e ) {
|
|
1628
1640
|
logger.error( 'uploadImage =>', e );
|
|
1629
1641
|
return res.sendError( e, 500 );
|
|
@@ -2077,7 +2089,7 @@ export async function createChecklistTask( req, res ) {
|
|
|
2077
2089
|
console.log( 'logData', logData );
|
|
2078
2090
|
await insertOpenSearchData( urlopensearch.traxActivityLog, logData );
|
|
2079
2091
|
}
|
|
2080
|
-
await insertSingleProcessData( response?._id );
|
|
2092
|
+
await insertSingleProcessData( response?._id, false, inputBody, 'gallery' );
|
|
2081
2093
|
return res.sendSuccess( 'Task created successfully' );
|
|
2082
2094
|
}
|
|
2083
2095
|
} catch ( e ) {
|
|
@@ -2122,39 +2134,73 @@ export async function createChecklistMultiTask( req, res ) {
|
|
|
2122
2134
|
|
|
2123
2135
|
let time = inputBody?.scheduleEndTime || '11:59 PM';
|
|
2124
2136
|
let date = inputBody?.scheduleDate || dayjs().format( 'YYYY-MM-DD' );
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2137
|
+
let checklistDetails = await checklistService.findOne( { _id: inputData[0]?.checkListId }, { coverage: 1 } );
|
|
2138
|
+
let data = {
|
|
2139
|
+
checkListName: inputBody.checkListName,
|
|
2140
|
+
checkListDescription: inputBody.checkListDescription,
|
|
2141
|
+
createdBy: req.user._id,
|
|
2142
|
+
createdByName: req.user.userName,
|
|
2143
|
+
publish: true,
|
|
2144
|
+
questionCount: 1,
|
|
2145
|
+
storeCount: 1,
|
|
2146
|
+
scheduleDate: date,
|
|
2147
|
+
scheduleEndTime: time,
|
|
2148
|
+
scheduleEndTimeISO: dayjs.utc( `${date} ${time}`, 'YYYY-MM-DD hh:mm A' ).format(),
|
|
2149
|
+
priorityType: 'high',
|
|
2150
|
+
client_id: inputBody.clientId,
|
|
2151
|
+
checkListType: inputBody.checkListType,
|
|
2152
|
+
publishDate: new Date(),
|
|
2153
|
+
locationCount: 1,
|
|
2154
|
+
...( inputData[0]?.checkListId ) ? { referenceCheckListId: inputData[0]?.checkListId } : {},
|
|
2155
|
+
coverage: checklistDetails?.coverage || 'store',
|
|
2156
|
+
checkListFrom: 'gallery',
|
|
2157
|
+
restrictAttendance: req.body.restrictAttendance,
|
|
2158
|
+
allowedStoreLocation: req.body.allowedStoreLocation,
|
|
2159
|
+
};
|
|
2160
|
+
console.log( data );
|
|
2161
|
+
if ( req.user.userType == 'tango' || ( req.user.userType == 'client' && [ 'user' ].includes( req.user.role ) ) ) {
|
|
2162
|
+
let userList = await userService.findOne( { clientId: inputBody.clientId, role: 'superadmin' }, { userName: 1, email: 1 } );
|
|
2163
|
+
if ( userList ) {
|
|
2164
|
+
data['approver'] = { name: userList.userName, value: userList.email };
|
|
2165
|
+
}
|
|
2166
|
+
} else {
|
|
2167
|
+
data['approver'] = { name: req.user.userName, value: req.user.email };
|
|
2168
|
+
}
|
|
2147
2169
|
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2170
|
+
let response = await taskService.create( data );
|
|
2171
|
+
let newquestion = {
|
|
2172
|
+
'qno': 1,
|
|
2173
|
+
'qname': inputBody.question[0].qname,
|
|
2174
|
+
'answerType': inputBody.question[0].answerType,
|
|
2175
|
+
'runAI': false,
|
|
2176
|
+
'runAIDescription': '',
|
|
2177
|
+
'allowUploadfromGallery': inputBody.question[0].allowUploadfromGallery,
|
|
2178
|
+
'linkType': false,
|
|
2179
|
+
'questionReferenceImage': inputBody.question[0].questionReferenceImage,
|
|
2180
|
+
'descriptivetype': inputBody.question[0].descriptivetype,
|
|
2181
|
+
'answers': inputBody.question[0].answers,
|
|
2182
|
+
};
|
|
2183
|
+
let question = {
|
|
2184
|
+
checkListId: response?._id,
|
|
2185
|
+
question: inputBody.showcomment ? inputBody.question : newquestion,
|
|
2186
|
+
section: 'Section 1',
|
|
2187
|
+
checkList: inputBody?.checkListName,
|
|
2188
|
+
client_id: inputBody.clientId,
|
|
2189
|
+
};
|
|
2190
|
+
console.log( question );
|
|
2191
|
+
await taskQuestionService.create( question );
|
|
2192
|
+
for ( let originaldata of inputData ) {
|
|
2193
|
+
let findcomment = {};
|
|
2194
|
+
if ( !inputBody.showcomment ) {
|
|
2195
|
+
if ( inputBody?.coverage === 'store' ) {
|
|
2196
|
+
findcomment = inputBody.excelData.find( ( ele ) => ele['Store Name'] === originaldata.storeName );
|
|
2197
|
+
} else if ( inputBody?.coverage === 'users' ) {
|
|
2198
|
+
findcomment = inputBody.excelData.find( ( ele ) => ele['User Email'] === originaldata.userEmail );
|
|
2152
2199
|
}
|
|
2153
|
-
} else {
|
|
2154
|
-
data['approver'] = { name: req.user.userName, value: req.user.email };
|
|
2155
2200
|
}
|
|
2201
|
+
console.log( '****************', findcomment );
|
|
2202
|
+
|
|
2156
2203
|
|
|
2157
|
-
let response = await taskService.create( data );
|
|
2158
2204
|
if ( response?.approver.length ) {
|
|
2159
2205
|
let data = [];
|
|
2160
2206
|
response?.approver.forEach( ( ele ) => {
|
|
@@ -2194,19 +2240,12 @@ export async function createChecklistMultiTask( req, res ) {
|
|
|
2194
2240
|
} );
|
|
2195
2241
|
inputBody.question[0].answers[0].referenceImage = images;
|
|
2196
2242
|
}
|
|
2197
|
-
|
|
2198
|
-
checkListId: response?._id,
|
|
2199
|
-
question: inputBody.question,
|
|
2200
|
-
section: 'Section 1',
|
|
2201
|
-
checkList: data.checkListName,
|
|
2202
|
-
client_id: inputBody.clientId,
|
|
2203
|
-
};
|
|
2204
|
-
await taskQuestionService.create( question );
|
|
2243
|
+
|
|
2205
2244
|
let storeDetails;
|
|
2206
2245
|
if ( originaldata?.storeName ) {
|
|
2207
2246
|
storeDetails = await storeService.findOne( { storeName: originaldata.storeName, status: 'active' }, { storeId: 1, storeProfile: 1 } );
|
|
2208
2247
|
}
|
|
2209
|
-
|
|
2248
|
+
let findUser = await userService.findOne( { email: originaldata.userEmail } );
|
|
2210
2249
|
let userDetails = {
|
|
2211
2250
|
userName: originaldata.userName ? originaldata.userName : '',
|
|
2212
2251
|
userEmail: originaldata.userEmail ? originaldata.userEmail : '',
|
|
@@ -2217,15 +2256,16 @@ export async function createChecklistMultiTask( req, res ) {
|
|
|
2217
2256
|
checkListId: response?._id,
|
|
2218
2257
|
checkListName: data.checkListName,
|
|
2219
2258
|
client_id: inputBody.clientId,
|
|
2220
|
-
userId:
|
|
2221
|
-
assignId: response?.coverage == 'store' ? storeDetails?._id :
|
|
2259
|
+
userId: findUser._id ? findUser._id : '',
|
|
2260
|
+
assignId: response?.coverage == 'store' ? storeDetails?._id : findUser._id,
|
|
2222
2261
|
coverage: response?.coverage || 'store',
|
|
2262
|
+
comments: inputBody?.showcomment ? inputBody.checkListDescription : findcomment?.Comments,
|
|
2223
2263
|
};
|
|
2224
2264
|
await taskAssignService.create( userDetails );
|
|
2225
2265
|
// console.log( originaldata?.checklistId );
|
|
2226
2266
|
if ( inputBody.checkListType == 'checklistTask' ) {
|
|
2227
2267
|
let taskDetails = await processedChecklist.findOne( { _id: originaldata?.checklistId }, { questionAnswers: 1, taskStatus: 1, checklistStatus: 1, client_id: 1, store_id: 1, storeName: 1, checkListType: 1, sourceCheckList_id: 1, checkListName: 1 } );
|
|
2228
|
-
|
|
2268
|
+
console.log( taskDetails );
|
|
2229
2269
|
if ( !taskDetails ) {
|
|
2230
2270
|
return res.sendError( 'No data found', 204 );
|
|
2231
2271
|
}
|
|
@@ -2235,7 +2275,7 @@ export async function createChecklistMultiTask( req, res ) {
|
|
|
2235
2275
|
return res.sendError( 'section is not found', 400 );
|
|
2236
2276
|
}
|
|
2237
2277
|
let findQuestion = question[sectionIndex].questions.findIndex( ( ele ) => ele.qno == req.body.qno );
|
|
2238
|
-
|
|
2278
|
+
console.log( findQuestion );
|
|
2239
2279
|
let data = { ...question[sectionIndex].questions[findQuestion], taskId: response?._id, task: true };
|
|
2240
2280
|
question[sectionIndex].questions[req.body.qno - 1] = data;
|
|
2241
2281
|
taskDetails.questionAnswers = question;
|
|
@@ -2243,6 +2283,7 @@ export async function createChecklistMultiTask( req, res ) {
|
|
|
2243
2283
|
taskStatus: true,
|
|
2244
2284
|
questionAnswers: question,
|
|
2245
2285
|
};
|
|
2286
|
+
console.log( updateData );
|
|
2246
2287
|
await processedChecklist.updateOne( { _id: originaldata.checklistId }, updateData );
|
|
2247
2288
|
let params = {
|
|
2248
2289
|
'payload': {
|
|
@@ -2298,7 +2339,7 @@ export async function createChecklistMultiTask( req, res ) {
|
|
|
2298
2339
|
console.log( 'logData', logData );
|
|
2299
2340
|
await insertOpenSearchData( urlopensearch.traxActivityLog, logData );
|
|
2300
2341
|
}
|
|
2301
|
-
await insertSingleProcessData( response?._id );
|
|
2342
|
+
await insertSingleProcessData( response?._id, false, inputBody, 'gallery' );
|
|
2302
2343
|
}
|
|
2303
2344
|
}
|
|
2304
2345
|
return res.sendSuccess( 'Task created successfully' );
|
|
@@ -2318,7 +2359,7 @@ export async function approveTask( req, res ) {
|
|
|
2318
2359
|
toDate = new Date( toDate.getTime() - userTimezoneOffset );
|
|
2319
2360
|
toDate.setUTCHours( 23, 59, 59, 59 );
|
|
2320
2361
|
let query = { sourceCheckList_id: req.body.sourceCheckList_id, date_iso: { $gte: req.body.fromDate, $lte: toDate }, $or: [ { checklistStatus: 'submit' }, { redoStatus: true } ], approvalEnable: true };
|
|
2321
|
-
if ( !( req.body.assignedStores && req.body.assignedStores.length >0 ) ) {
|
|
2362
|
+
if ( !( req.body.assignedStores && req.body.assignedStores.length > 0 ) ) {
|
|
2322
2363
|
req.body.assignedStores = req.body.storeId;
|
|
2323
2364
|
}
|
|
2324
2365
|
if ( req.body?.storeId?.length ) {
|
|
@@ -2346,13 +2387,13 @@ export async function approveTask( req, res ) {
|
|
|
2346
2387
|
|
|
2347
2388
|
let teamsMsg;
|
|
2348
2389
|
let teamsAlertUrls = process.env.teamsAlertURL ? JSON.parse( process.env.teamsAlertURL ) : '';
|
|
2349
|
-
teamsMsg = 'ClientId: '+ taskDetails[0].client_id + ', Type: Task, Process: started, Action: Approval, ChecklistId: '+ taskDetails[0].sourceCheckList_id + ', Task Name: '+ taskDetails[0].checkListName +', UpDatedBy: '+ req.user.email;
|
|
2390
|
+
teamsMsg = 'ClientId: ' + taskDetails[0].client_id + ', Type: Task, Process: started, Action: Approval, ChecklistId: ' + taskDetails[0].sourceCheckList_id + ', Task Name: ' + taskDetails[0].checkListName + ', UpDatedBy: ' + req.user.email;
|
|
2350
2391
|
if ( teamsAlertUrls && teamsAlertUrls.approvalAlert ) {
|
|
2351
2392
|
sendTeamsNotification( teamsAlertUrls.approvalAlert, teamsMsg );
|
|
2352
2393
|
}
|
|
2353
2394
|
|
|
2354
2395
|
if ( updateResponse.modifiedCount || updateResponse.matchedCount ) {
|
|
2355
|
-
teamsMsg = 'ClientId: '+ taskDetails[0].client_id + ', Type: Task, Process: Completed, Updated Count: '+updateResponse.modifiedCount+' Action: Approval, ChecklistId: '+ taskDetails[0].sourceCheckList_id + ', Task Name: '+ taskDetails[0].checkListName +', UpDatedBy: '+ req.user.email;
|
|
2396
|
+
teamsMsg = 'ClientId: ' + taskDetails[0].client_id + ', Type: Task, Process: Completed, Updated Count: ' + updateResponse.modifiedCount + ' Action: Approval, ChecklistId: ' + taskDetails[0].sourceCheckList_id + ', Task Name: ' + taskDetails[0].checkListName + ', UpDatedBy: ' + req.user.email;
|
|
2356
2397
|
if ( teamsAlertUrls && teamsAlertUrls.approvalAlert ) {
|
|
2357
2398
|
sendTeamsNotification( teamsAlertUrls.approvalAlert, teamsMsg );
|
|
2358
2399
|
}
|
|
@@ -2470,13 +2511,13 @@ export async function redoTask( req, res ) {
|
|
|
2470
2511
|
let response = await taskProcessedService.updateOne( { _id: req.body.payload._id }, updateData );
|
|
2471
2512
|
// console.log( response );
|
|
2472
2513
|
if ( response.modifiedCount || response.matchedCount ) {
|
|
2473
|
-
let storeTimeZone = await storeService.findOne( { storeName: taskDetails.storeName }, { 'storeProfile.timeZone': 1 } );
|
|
2474
|
-
let currentDateTime;
|
|
2475
|
-
if ( storeTimeZone?.storeProfile?.timeZone ) {
|
|
2476
|
-
|
|
2477
|
-
} else {
|
|
2478
|
-
|
|
2479
|
-
}
|
|
2514
|
+
// let storeTimeZone = await storeService.findOne( { storeName: taskDetails.storeName }, { 'storeProfile.timeZone': 1 } );
|
|
2515
|
+
// let currentDateTime;
|
|
2516
|
+
// if ( storeTimeZone?.storeProfile?.timeZone ) {
|
|
2517
|
+
// currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
|
|
2518
|
+
// } else {
|
|
2519
|
+
// currentDateTime = dayjs();
|
|
2520
|
+
// }
|
|
2480
2521
|
data = {
|
|
2481
2522
|
checklistId: taskDetails.sourceCheckList_id,
|
|
2482
2523
|
checkListName: taskDetails.checkListName,
|
|
@@ -2492,10 +2533,10 @@ export async function redoTask( req, res ) {
|
|
|
2492
2533
|
type: taskDetails.checkListType,
|
|
2493
2534
|
userAnswer: userAnswer,
|
|
2494
2535
|
initiatedBy: req.user.userName,
|
|
2495
|
-
initiatedTime: dayjs.utc(
|
|
2536
|
+
initiatedTime: dayjs.utc( ).format(),
|
|
2496
2537
|
answerType: question[sectionIndex].questions[req.body.payload.qno - 1].answerType,
|
|
2497
2538
|
submitedBy: taskDetails.userName,
|
|
2498
|
-
submitTime: taskDetails.submitTime,
|
|
2539
|
+
submitTime: dayjs.utc( taskDetails.submitTime ).format(),
|
|
2499
2540
|
};
|
|
2500
2541
|
|
|
2501
2542
|
await checklistLogs.create( data );
|
|
@@ -2585,13 +2626,13 @@ export async function redomultiTask( req, res ) {
|
|
|
2585
2626
|
let response = await taskProcessedService.updateOne( { _id: originalData.checklistId }, updateData );
|
|
2586
2627
|
// console.log( response );
|
|
2587
2628
|
if ( response.modifiedCount || response.matchedCount ) {
|
|
2588
|
-
let storeTimeZone = await storeService.findOne( { storeName: taskDetails.storeName }, { 'storeProfile.timeZone': 1 } );
|
|
2589
|
-
let currentDateTime;
|
|
2590
|
-
if ( storeTimeZone?.storeProfile?.timeZone ) {
|
|
2591
|
-
|
|
2592
|
-
} else {
|
|
2593
|
-
|
|
2594
|
-
}
|
|
2629
|
+
// let storeTimeZone = await storeService.findOne( { storeName: taskDetails.storeName }, { 'storeProfile.timeZone': 1 } );
|
|
2630
|
+
// let currentDateTime;
|
|
2631
|
+
// if ( storeTimeZone?.storeProfile?.timeZone ) {
|
|
2632
|
+
// currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
|
|
2633
|
+
// } else {
|
|
2634
|
+
// currentDateTime = dayjs();
|
|
2635
|
+
// }
|
|
2595
2636
|
data = {
|
|
2596
2637
|
checklistId: taskDetails.sourceCheckList_id,
|
|
2597
2638
|
checkListName: taskDetails.checkListName,
|
|
@@ -2607,15 +2648,16 @@ export async function redomultiTask( req, res ) {
|
|
|
2607
2648
|
type: taskDetails.checkListType,
|
|
2608
2649
|
userAnswer: userAnswer,
|
|
2609
2650
|
initiatedBy: req.user.userName,
|
|
2610
|
-
initiatedTime: dayjs.utc(
|
|
2651
|
+
initiatedTime: dayjs.utc().format(),
|
|
2611
2652
|
answerType: question[sectionIndex].questions[req.body.payload.qno - 1].answerType,
|
|
2612
2653
|
submitedBy: taskDetails.userName,
|
|
2613
|
-
submitTime: taskDetails.submitTime,
|
|
2654
|
+
submitTime: dayjs.utc( taskDetails.submitTime ).format(),
|
|
2614
2655
|
};
|
|
2615
2656
|
req.body.payload._id = originalData.checklistId;
|
|
2616
2657
|
req.body.payload.section_id = originalData.section_id;
|
|
2617
2658
|
req.body.payload.uniqueNo = originalData.uniqueNo;
|
|
2618
2659
|
await checklistLogs.create( data );
|
|
2660
|
+
|
|
2619
2661
|
const requestOptions = {
|
|
2620
2662
|
method: 'POST',
|
|
2621
2663
|
headers: {
|
|
@@ -2835,6 +2877,7 @@ export async function approvalstatus( req, res ) {
|
|
|
2835
2877
|
if ( ( req?.user?.userType == 'client' && req.user.role == 'superadmin' ) ) {
|
|
2836
2878
|
let url = JSON.parse( process.env.LAMBDAURL );
|
|
2837
2879
|
let resultData = await LamdaServiceCall( url.approvalstatustask, req.body );
|
|
2880
|
+
console.log( resultData );
|
|
2838
2881
|
if ( resultData ) {
|
|
2839
2882
|
if ( resultData.status_code == '200' ) {
|
|
2840
2883
|
return res.sendSuccess( resultData );
|
|
@@ -2848,6 +2891,7 @@ export async function approvalstatus( req, res ) {
|
|
|
2848
2891
|
|
|
2849
2892
|
let url = JSON.parse( process.env.LAMBDAURL );
|
|
2850
2893
|
let resultData = await LamdaServiceCall( url.approvalstatustask, req.body );
|
|
2894
|
+
console.log( resultData );
|
|
2851
2895
|
|
|
2852
2896
|
if ( resultData ) {
|
|
2853
2897
|
if ( resultData.status_code == '200' ) {
|
|
@@ -2863,6 +2907,39 @@ export async function approvalstatus( req, res ) {
|
|
|
2863
2907
|
return res.sendError( error, 500 );
|
|
2864
2908
|
}
|
|
2865
2909
|
}
|
|
2910
|
+
export async function allapprovalstatus( req, res ) {
|
|
2911
|
+
try {
|
|
2912
|
+
if ( ( req?.user?.userType == 'client' && req.user.role == 'superadmin' ) ) {
|
|
2913
|
+
let url = JSON.parse( process.env.LAMBDAURL );
|
|
2914
|
+
let resultData = await LamdaServiceCall( url.approvalstatustask, req.body );
|
|
2915
|
+
console.log( resultData );
|
|
2916
|
+
if ( resultData ) {
|
|
2917
|
+
if ( resultData.status_code == '200' ) {
|
|
2918
|
+
return res.sendSuccess( resultData );
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
return res.sendError( 'No Content', 204 );
|
|
2922
|
+
}
|
|
2923
|
+
|
|
2924
|
+
|
|
2925
|
+
let url = JSON.parse( process.env.LAMBDAURL );
|
|
2926
|
+
let resultData = await LamdaServiceCall( url.approvalstatustask, req.body );
|
|
2927
|
+
console.log( resultData );
|
|
2928
|
+
|
|
2929
|
+
if ( resultData ) {
|
|
2930
|
+
if ( resultData.status_code == '200' ) {
|
|
2931
|
+
return res.sendSuccess( resultData );
|
|
2932
|
+
} else {
|
|
2933
|
+
return res.sendError( 'No Content', 204 );
|
|
2934
|
+
}
|
|
2935
|
+
} else {
|
|
2936
|
+
return res.sendError( 'No Content', 204 );
|
|
2937
|
+
}
|
|
2938
|
+
} catch ( error ) {
|
|
2939
|
+
logger.error( error, 'allapprovalstatus' );
|
|
2940
|
+
return res.sendError( error, 500 );
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2866
2943
|
|
|
2867
2944
|
export const taskList = async ( req, res ) => {
|
|
2868
2945
|
try {
|
|
@@ -3264,7 +3341,7 @@ export async function teamMigrations( req, res ) {
|
|
|
3264
3341
|
}
|
|
3265
3342
|
export async function clusterMigrations( req, res ) {
|
|
3266
3343
|
try {
|
|
3267
|
-
let input =[];
|
|
3344
|
+
let input = [];
|
|
3268
3345
|
for ( let user of input ) {
|
|
3269
3346
|
let userexits = await userService.findOne( { 'email': user.clusterEmail, 'clientId': '11' } );
|
|
3270
3347
|
if ( userexits ) {
|
|
@@ -24,6 +24,7 @@ taskRouter
|
|
|
24
24
|
.post( '/getAnswers', isAllowedSessionHandler, taskController.getAnswers )
|
|
25
25
|
.post( '/getAnswerCount', isAllowedSessionHandler, taskController.getAnswerCount )
|
|
26
26
|
.post( '/approvalstatus', isAllowedSessionHandler, taskController.approvalstatus )
|
|
27
|
+
.post( '/allapprovalstatus', isAllowedSessionHandler, taskController.allapprovalstatus )
|
|
27
28
|
.get( '/task-list', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ ] } ] } ), taskController.taskList )
|
|
28
29
|
.put( '/publish', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.updatePublish )
|
|
29
30
|
.get( '/duplicateTask/:checklistId', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.duplicateChecklist )
|