tango-app-api-task 3.6.2-bulktask-8 → 3.7.2-multireff-1

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.6.2-bulktask-8",
3
+ "version": "3.7.2-multireff-1",
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.201",
28
+ "tango-api-schema": "^2.2.193",
29
29
  "tango-app-api-middleware": "^3.1.77",
30
30
  "winston": "^3.17.0",
31
31
  "winston-daily-rotate-file": "^5.0.0"
@@ -117,26 +117,26 @@ export async function createUpdateTask( req, res ) {
117
117
  for ( let i = 0; i < inputBody?.sections?.length; i++ ) {
118
118
  let section = inputBody.sections[i];
119
119
  section.questions.forEach( ( section ) => {
120
- if ( section.questionReferenceImage && section.questionReferenceImage.length ) {
121
- let image = [];
122
- for ( let img of section.questionReferenceImage ) {
123
- let imgUrl = decodeURIComponent( img.split( '?' )[0] );
124
- let url = imgUrl.split( '/' );
125
- url.splice( 0, 3 );
126
- image.push( url.join( '/' ) );
127
- }
128
- section.questionReferenceImage = image;
129
- }
130
- section.answers.forEach( ( answer ) => {
131
- if ( answer.referenceImage.length ) {
132
- answer.referenceImage = answer.referenceImage.map( ( value ) => {
133
- let imgUrl = decodeURIComponent( value?.split( '?' )[0] );
134
- let url = imgUrl.split( '/' );
135
- url.splice( 0, 3 );
136
- return url.join( '/' );
137
- } );
138
- }
139
- } );
120
+ // if ( section.questionReferenceImage && section.questionReferenceImage.length ) {
121
+ // let image = [];
122
+ // for ( let img of section.questionReferenceImage ) {
123
+ // let imgUrl = decodeURIComponent( img.split( '?' )[0] );
124
+ // let url = imgUrl.split( '/' );
125
+ // url.splice( 0, 3 );
126
+ // image.push( url.join( '/' ) );
127
+ // }
128
+ // section.questionReferenceImage = image;
129
+ // }
130
+ // section.answers.forEach( ( answer ) => {
131
+ // if ( answer.referenceImage.length ) {
132
+ // answer.referenceImage = answer.referenceImage.map( ( value ) => {
133
+ // let imgUrl = decodeURIComponent( value?.split( '?' )[0] );
134
+ // let url = imgUrl.split( '/' );
135
+ // url.splice( 0, 3 );
136
+ // return url.join( '/' );
137
+ // } );
138
+ // }
139
+ // } );
140
140
  } );
141
141
 
142
142
  sectionList.push( {
@@ -256,7 +256,8 @@ export async function createUpdateTask( req, res ) {
256
256
  },
257
257
  userType: req?.user?.userType || '',
258
258
  };
259
- await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, insertLogData );
259
+ // await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, insertLogData );
260
+ insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, insertLogData );
260
261
  }
261
262
  } else {
262
263
  let logObj = {
@@ -275,7 +276,8 @@ export async function createUpdateTask( req, res ) {
275
276
  logDetails: {},
276
277
  userType: req?.user?.userType || '',
277
278
  };
278
- await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, logObj );
279
+ // await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, logObj );
280
+ insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, logObj );
279
281
  }
280
282
 
281
283
  if ( inputBody?.submitType == 'save' ) {
@@ -295,7 +297,8 @@ export async function createUpdateTask( req, res ) {
295
297
  logDetails: {},
296
298
  userType: req?.user?.userType || '',
297
299
  };
298
- await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, logObj );
300
+ // await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, logObj );
301
+ insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, logObj );
299
302
  }
300
303
  return res.sendSuccess( { checklistId: checkListId, message: message } );
301
304
  } else {
@@ -360,42 +363,42 @@ export async function taskDetails( req, res ) {
360
363
  let questionDetails = await taskQuestionService.find( query );
361
364
  if ( questionDetails.length ) {
362
365
  let sections = [];
363
- let bucket = JSON.parse( process.env.BUCKET );
366
+ // let bucket = JSON.parse( process.env.BUCKET );
364
367
  questionDetails.forEach( ( item ) => {
365
- item.question.forEach( async ( question ) => {
366
- if ( question.questionReferenceImage && question.questionReferenceImage != '' && typeof question.questionReferenceImage == 'string' ) {
367
- let inputData = {
368
- Bucket: bucket.sop,
369
- file_path: decodeURIComponent( question.questionReferenceImage ),
370
- };
371
- question.questionReferenceImage = await signedUrl( inputData );
372
- } else {
373
- if ( question.questionReferenceImage.length ) {
374
- let image = [];
375
- for ( let img of question.questionReferenceImage ) {
376
- let inputData = {
377
- Bucket: bucket.sop,
378
- file_path: decodeURIComponent( img ),
379
- };
380
- image.push( await signedUrl( inputData ) );
381
- }
382
- question.questionReferenceImage = image;
383
- }
384
- }
385
- question.answers.forEach( async ( answer ) => {
386
- if ( answer.referenceImage.length > 0 ) {
387
- let updatedImages = [];
388
- for ( let refImage of answer.referenceImage ) {
389
- let inputData = {
390
- Bucket: bucket.sop,
391
- file_path: decodeURIComponent( refImage ),
392
- };
393
- updatedImages.push( await signedUrl( inputData ) );
394
- }
395
- answer.referenceImage = updatedImages;
396
- }
397
- } );
398
- } );
368
+ // item.question.forEach( async ( question ) => {
369
+ // if ( question.questionReferenceImage && question.questionReferenceImage != '' && typeof question.questionReferenceImage == 'string' ) {
370
+ // let inputData = {
371
+ // Bucket: bucket.sop,
372
+ // file_path: decodeURIComponent( question.questionReferenceImage ),
373
+ // };
374
+ // question.questionReferenceImage = await signedUrl( inputData );
375
+ // } else {
376
+ // if ( question.questionReferenceImage.length ) {
377
+ // let image = [];
378
+ // for ( let img of question.questionReferenceImage ) {
379
+ // let inputData = {
380
+ // Bucket: bucket.sop,
381
+ // file_path: decodeURIComponent( img ),
382
+ // };
383
+ // image.push( await signedUrl( inputData ) );
384
+ // }
385
+ // question.questionReferenceImage = image;
386
+ // }
387
+ // }
388
+ // question.answers.forEach( async ( answer ) => {
389
+ // if ( answer.referenceImage.length > 0 ) {
390
+ // let updatedImages = [];
391
+ // for ( let refImage of answer.referenceImage ) {
392
+ // let inputData = {
393
+ // Bucket: bucket.sop,
394
+ // file_path: decodeURIComponent( refImage ),
395
+ // };
396
+ // updatedImages.push( await signedUrl( inputData ) );
397
+ // }
398
+ // answer.referenceImage = updatedImages;
399
+ // }
400
+ // } );
401
+ // } );
399
402
  sections.push( {
400
403
  id: item._id,
401
404
  name: item.section,
@@ -1229,7 +1232,7 @@ function findObjectDifference( oldObj, newObj ) {
1229
1232
  }
1230
1233
 
1231
1234
 
1232
- export async function insertSingleProcessData( checklistId, answerTypechange, inputBody, insertfrom ) {
1235
+ export async function insertSingleProcessData( checklistId, answerTypechange, inputBody ) {
1233
1236
  try {
1234
1237
  let currentdate = new Date();
1235
1238
  let date = dayjs( currentdate ).format();
@@ -1343,7 +1346,7 @@ export async function insertSingleProcessData( checklistId, answerTypechange, in
1343
1346
  updatedchecklist = checklistDetails;
1344
1347
  }
1345
1348
  if ( updatedchecklist ) {
1346
- await insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, dateVal, startTimeIso, endTimeIso, insertdata, answerTypechange, inputBody, insertfrom );
1349
+ await insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, dateVal, startTimeIso, endTimeIso, insertdata, answerTypechange, inputBody );
1347
1350
  }
1348
1351
  }
1349
1352
  }
@@ -1355,7 +1358,7 @@ export async function insertSingleProcessData( checklistId, answerTypechange, in
1355
1358
  }
1356
1359
  };
1357
1360
 
1358
- async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date, startTimeIso, endTimeIso, insertdata, answerTypechange, inputBody, insertfrom ) {
1361
+ async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date, startTimeIso, endTimeIso, insertdata, answerTypechange, inputBody ) {
1359
1362
  let getquestionQuery = [];
1360
1363
 
1361
1364
  if ( dayjs( getCLconfig.publishDate ).format( 'YYYY-MM-DD' ) != dayjs( date ).format( 'YYYY-MM-DD' ) ) {
@@ -1528,20 +1531,10 @@ async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date,
1528
1531
  if ( inputBody && inputBody?.streamId ) {
1529
1532
  element4.streamId = inputBody?.streamId;
1530
1533
  }
1531
- console.log( insertdata.questionAnswers, element4.comments );
1532
1534
  if ( answerTypechange ) {
1533
1535
  element4.questionAnswers = insertdata.questionAnswers;
1534
1536
  element4.planoType = 'qrScan';
1535
1537
  }
1536
-
1537
- if ( insertfrom === 'gallery' ) {
1538
- // Clone the data to prevent shared reference
1539
- const clonedQuestionAnswers = JSON.parse( JSON.stringify( insertdata.questionAnswers ) );
1540
- clonedQuestionAnswers[0].questions[0].qcomment = element4.comments;
1541
-
1542
- element4.questionAnswers = clonedQuestionAnswers;
1543
- }
1544
-
1545
1538
  element4.coverage = getCLconfig?.coverage;
1546
1539
  assignUserList.push( element4 );
1547
1540
  }
@@ -1578,8 +1571,6 @@ async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date,
1578
1571
  item1.store_id === item2.store_id && item1.userEmail === item2.userEmail,
1579
1572
  ),
1580
1573
  );
1581
-
1582
-
1583
1574
  await taskProcessedService.insertMany( insertList );
1584
1575
  logger.info( { function: 'insertPCBulk_v3', query: assigndeletequery } );
1585
1576
  }
@@ -1632,7 +1623,7 @@ export async function uploadImage( req, res ) {
1632
1623
  return res.sendError( { message: 'Something went wrong' }, 500 );
1633
1624
  }
1634
1625
 
1635
- return res.sendSuccess( { message: 'Uploaded Successfully', imgUrl: imgUrl, path: inputData.file_path } );
1626
+ return res.sendSuccess( { message: 'Uploaded Successfully', imgUrl: imgUrl } );
1636
1627
  } catch ( e ) {
1637
1628
  logger.error( 'uploadImage =>', e );
1638
1629
  return res.sendError( e, 500 );
@@ -2086,7 +2077,7 @@ export async function createChecklistTask( req, res ) {
2086
2077
  console.log( 'logData', logData );
2087
2078
  await insertOpenSearchData( urlopensearch.traxActivityLog, logData );
2088
2079
  }
2089
- await insertSingleProcessData( response?._id, false, inputBody, 'gallery' );
2080
+ await insertSingleProcessData( response?._id );
2090
2081
  return res.sendSuccess( 'Task created successfully' );
2091
2082
  }
2092
2083
  } catch ( e ) {
@@ -2131,73 +2122,39 @@ export async function createChecklistMultiTask( req, res ) {
2131
2122
 
2132
2123
  let time = inputBody?.scheduleEndTime || '11:59 PM';
2133
2124
  let date = inputBody?.scheduleDate || dayjs().format( 'YYYY-MM-DD' );
2134
- let checklistDetails = await checklistService.findOne( { _id: inputData[0]?.checkListId }, { coverage: 1 } );
2135
- let data = {
2136
- checkListName: inputBody.checkListName,
2137
- checkListDescription: inputBody.checkListDescription,
2138
- createdBy: req.user._id,
2139
- createdByName: req.user.userName,
2140
- publish: true,
2141
- questionCount: 1,
2142
- storeCount: 1,
2143
- scheduleDate: date,
2144
- scheduleEndTime: time,
2145
- scheduleEndTimeISO: dayjs.utc( `${date} ${time}`, 'YYYY-MM-DD hh:mm A' ).format(),
2146
- priorityType: 'high',
2147
- client_id: inputBody.clientId,
2148
- checkListType: inputBody.checkListType,
2149
- publishDate: new Date(),
2150
- locationCount: 1,
2151
- ...( inputData[0]?.checkListId ) ? { referenceCheckListId: inputData[0]?.checkListId } : {},
2152
- coverage: checklistDetails?.coverage || 'store',
2153
- checkListFrom: 'gallery',
2154
- restrictAttendance: req.body.restrictAttendance,
2155
- allowedStoreLocation: req.body.allowedStoreLocation,
2156
- };
2157
- console.log( data );
2158
- if ( req.user.userType == 'tango' || ( req.user.userType == 'client' && [ 'user' ].includes( req.user.role ) ) ) {
2159
- let userList = await userService.findOne( { clientId: inputBody.clientId, role: 'superadmin' }, { userName: 1, email: 1 } );
2160
- if ( userList ) {
2161
- data['approver'] = { name: userList.userName, value: userList.email };
2162
- }
2163
- } else {
2164
- data['approver'] = { name: req.user.userName, value: req.user.email };
2165
- }
2166
-
2167
- let response = await taskService.create( data );
2168
- let newquestion = {
2169
- 'qno': 1,
2170
- 'qname': inputBody.question[0].qname,
2171
- 'answerType': inputBody.question[0].answerType,
2172
- 'runAI': false,
2173
- 'runAIDescription': '',
2174
- 'allowUploadfromGallery': inputBody.question[0].allowUploadfromGallery,
2175
- 'linkType': false,
2176
- 'questionReferenceImage': inputBody.question[0].questionReferenceImage,
2177
- 'descriptivetype': inputBody.question[0].descriptivetype,
2178
- 'answers': inputBody.question[0].answers,
2179
- };
2180
- let question = {
2181
- checkListId: response?._id,
2182
- question: inputBody.showcomment ? inputBody.question : newquestion,
2183
- section: 'Section 1',
2184
- checkList: inputBody?.checkListName,
2185
- client_id: inputBody.clientId,
2186
- };
2187
- console.log( question );
2188
- await taskQuestionService.create( question );
2189
2125
  for ( let originaldata of inputData ) {
2190
- let findcomment = {};
2191
- if ( !inputBody.showcomment ) {
2192
- if ( inputBody?.coverage === 'store' ) {
2193
- findcomment = inputBody.excelData.find( ( ele ) => ele['Store Name'] === originaldata.storeName );
2194
- } else if ( inputBody?.coverage === 'users' ) {
2195
- findcomment = inputBody.excelData.find( ( ele ) => ele['User Email'] === originaldata.userEmail );
2126
+ let checklistDetails = await checklistService.findOne( { _id: originaldata?.checkListId }, { coverage: 1 } );
2127
+ let data = {
2128
+ checkListName: inputBody.checkListName,
2129
+ checkListDescription: inputBody.checkListDescription,
2130
+ createdBy: req.user._id,
2131
+ createdByName: req.user.userName,
2132
+ publish: true,
2133
+ questionCount: 1,
2134
+ storeCount: 1,
2135
+ scheduleDate: date,
2136
+ scheduleEndTime: time,
2137
+ scheduleEndTimeISO: dayjs.utc( `${date} ${time}`, 'YYYY-MM-DD hh:mm A' ).format(),
2138
+ priorityType: 'high',
2139
+ client_id: inputBody.clientId,
2140
+ checkListType: inputBody.checkListType,
2141
+ publishDate: new Date(),
2142
+ locationCount: 1,
2143
+ ...( originaldata?.checkListId ) ? { referenceCheckListId: originaldata?.checkListId } : {},
2144
+ coverage: checklistDetails?.coverage || 'store',
2145
+ checkListFrom: 'gallery',
2146
+ };
2147
+
2148
+ if ( req.user.userType == 'tango' || ( req.user.userType == 'client' && [ 'user' ].includes( req.user.role ) ) ) {
2149
+ let userList = await userService.findOne( { clientId: inputBody.clientId, role: 'superadmin' }, { userName: 1, email: 1 } );
2150
+ if ( userList ) {
2151
+ data['approver'] = { name: userList.userName, value: userList.email };
2196
2152
  }
2153
+ } else {
2154
+ data['approver'] = { name: req.user.userName, value: req.user.email };
2197
2155
  }
2198
- console.log( '****************', findcomment );
2199
-
2200
2156
 
2157
+ let response = await taskService.create( data );
2201
2158
  if ( response?.approver.length ) {
2202
2159
  let data = [];
2203
2160
  response?.approver.forEach( ( ele ) => {
@@ -2237,12 +2194,19 @@ export async function createChecklistMultiTask( req, res ) {
2237
2194
  } );
2238
2195
  inputBody.question[0].answers[0].referenceImage = images;
2239
2196
  }
2240
-
2197
+ let question = {
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 );
2241
2205
  let storeDetails;
2242
2206
  if ( originaldata?.storeName ) {
2243
2207
  storeDetails = await storeService.findOne( { storeName: originaldata.storeName, status: 'active' }, { storeId: 1, storeProfile: 1 } );
2244
2208
  }
2245
- let findUser = await userService.findOne( { email: originaldata.userEmail } );
2209
+
2246
2210
  let userDetails = {
2247
2211
  userName: originaldata.userName ? originaldata.userName : '',
2248
2212
  userEmail: originaldata.userEmail ? originaldata.userEmail : '',
@@ -2253,16 +2217,15 @@ export async function createChecklistMultiTask( req, res ) {
2253
2217
  checkListId: response?._id,
2254
2218
  checkListName: data.checkListName,
2255
2219
  client_id: inputBody.clientId,
2256
- userId: findUser._id ? findUser._id : '',
2257
- assignId: response?.coverage == 'store' ? storeDetails?._id : findUser._id,
2220
+ userId: userDetailList && userDetailList._id ? userDetailList._id : '',
2221
+ assignId: response?.coverage == 'store' ? storeDetails?._id : userDetailList._id,
2258
2222
  coverage: response?.coverage || 'store',
2259
- comments: inputBody?.showcomment ? inputBody.checkListDescription : findcomment?.Comments,
2260
2223
  };
2261
2224
  await taskAssignService.create( userDetails );
2262
2225
  // console.log( originaldata?.checklistId );
2263
2226
  if ( inputBody.checkListType == 'checklistTask' ) {
2264
2227
  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 } );
2265
- console.log( taskDetails );
2228
+ // console.log( taskDetails );
2266
2229
  if ( !taskDetails ) {
2267
2230
  return res.sendError( 'No data found', 204 );
2268
2231
  }
@@ -2272,7 +2235,7 @@ export async function createChecklistMultiTask( req, res ) {
2272
2235
  return res.sendError( 'section is not found', 400 );
2273
2236
  }
2274
2237
  let findQuestion = question[sectionIndex].questions.findIndex( ( ele ) => ele.qno == req.body.qno );
2275
- console.log( findQuestion );
2238
+
2276
2239
  let data = { ...question[sectionIndex].questions[findQuestion], taskId: response?._id, task: true };
2277
2240
  question[sectionIndex].questions[req.body.qno - 1] = data;
2278
2241
  taskDetails.questionAnswers = question;
@@ -2280,7 +2243,6 @@ export async function createChecklistMultiTask( req, res ) {
2280
2243
  taskStatus: true,
2281
2244
  questionAnswers: question,
2282
2245
  };
2283
- console.log( updateData );
2284
2246
  await processedChecklist.updateOne( { _id: originaldata.checklistId }, updateData );
2285
2247
  let params = {
2286
2248
  'payload': {
@@ -2336,7 +2298,7 @@ export async function createChecklistMultiTask( req, res ) {
2336
2298
  console.log( 'logData', logData );
2337
2299
  await insertOpenSearchData( urlopensearch.traxActivityLog, logData );
2338
2300
  }
2339
- await insertSingleProcessData( response?._id, false, inputBody, 'gallery' );
2301
+ await insertSingleProcessData( response?._id );
2340
2302
  }
2341
2303
  }
2342
2304
  return res.sendSuccess( 'Task created successfully' );
@@ -2356,7 +2318,7 @@ export async function approveTask( req, res ) {
2356
2318
  toDate = new Date( toDate.getTime() - userTimezoneOffset );
2357
2319
  toDate.setUTCHours( 23, 59, 59, 59 );
2358
2320
  let query = { sourceCheckList_id: req.body.sourceCheckList_id, date_iso: { $gte: req.body.fromDate, $lte: toDate }, $or: [ { checklistStatus: 'submit' }, { redoStatus: true } ], approvalEnable: true };
2359
- if ( !( req.body.assignedStores && req.body.assignedStores.length > 0 ) ) {
2321
+ if ( !( req.body.assignedStores && req.body.assignedStores.length >0 ) ) {
2360
2322
  req.body.assignedStores = req.body.storeId;
2361
2323
  }
2362
2324
  if ( req.body?.storeId?.length ) {
@@ -2384,13 +2346,13 @@ export async function approveTask( req, res ) {
2384
2346
 
2385
2347
  let teamsMsg;
2386
2348
  let teamsAlertUrls = process.env.teamsAlertURL ? JSON.parse( process.env.teamsAlertURL ) : '';
2387
- 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;
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;
2388
2350
  if ( teamsAlertUrls && teamsAlertUrls.approvalAlert ) {
2389
2351
  sendTeamsNotification( teamsAlertUrls.approvalAlert, teamsMsg );
2390
2352
  }
2391
2353
 
2392
2354
  if ( updateResponse.modifiedCount || updateResponse.matchedCount ) {
2393
- 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;
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;
2394
2356
  if ( teamsAlertUrls && teamsAlertUrls.approvalAlert ) {
2395
2357
  sendTeamsNotification( teamsAlertUrls.approvalAlert, teamsMsg );
2396
2358
  }
@@ -2530,10 +2492,10 @@ export async function redoTask( req, res ) {
2530
2492
  type: taskDetails.checkListType,
2531
2493
  userAnswer: userAnswer,
2532
2494
  initiatedBy: req.user.userName,
2533
- initiatedTime: dayjs.utc( ).format(),
2495
+ initiatedTime: dayjs.utc( currentDateTime.format( 'hh:mm:ss A, DD MMM YYYY' ), 'hh:mm:ss A, DD MMM YYYY' ).format(),
2534
2496
  answerType: question[sectionIndex].questions[req.body.payload.qno - 1].answerType,
2535
2497
  submitedBy: taskDetails.userName,
2536
- submitTime: dayjs.utc( taskDetails.submitTime ).format(),
2498
+ submitTime: taskDetails.submitTime,
2537
2499
  };
2538
2500
 
2539
2501
  await checklistLogs.create( data );
@@ -2645,10 +2607,10 @@ export async function redomultiTask( req, res ) {
2645
2607
  type: taskDetails.checkListType,
2646
2608
  userAnswer: userAnswer,
2647
2609
  initiatedBy: req.user.userName,
2648
- initiatedTime: dayjs.utc().format(),
2610
+ initiatedTime: dayjs.utc( currentDateTime.format( 'hh:mm:ss A, DD MMM YYYY' ), 'hh:mm:ss A, DD MMM YYYY' ).format(),
2649
2611
  answerType: question[sectionIndex].questions[req.body.payload.qno - 1].answerType,
2650
2612
  submitedBy: taskDetails.userName,
2651
- submitTime: dayjs.utc( taskDetails.submitTime ).format(),
2613
+ submitTime: taskDetails.submitTime,
2652
2614
  };
2653
2615
  req.body.payload._id = originalData.checklistId;
2654
2616
  req.body.payload.section_id = originalData.section_id;
@@ -3302,7 +3264,7 @@ export async function teamMigrations( req, res ) {
3302
3264
  }
3303
3265
  export async function clusterMigrations( req, res ) {
3304
3266
  try {
3305
- let input = [];
3267
+ let input =[];
3306
3268
  for ( let user of input ) {
3307
3269
  let userexits = await userService.findOne( { 'email': user.clusterEmail, 'clientId': '11' } );
3308
3270
  if ( userexits ) {