tango-app-api-task 3.6.2-bulktask-2 → 3.6.2-bulktask-4

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-2",
3
+ "version": "3.6.2-bulktask-4",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1535,7 +1535,7 @@ async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date,
1535
1535
  }
1536
1536
 
1537
1537
  if ( insertfrom === 'gallery' ) {
1538
- // Clone the data to prevent shared reference
1538
+ // Clone the data to prevent shared reference
1539
1539
  const clonedQuestionAnswers = JSON.parse( JSON.stringify( insertdata.questionAnswers ) );
1540
1540
  clonedQuestionAnswers[0].questions[0].qcomment = element4.comments;
1541
1541
 
@@ -1579,9 +1579,6 @@ async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date,
1579
1579
  ),
1580
1580
  );
1581
1581
 
1582
- // for ( let insertdetail of insertList ) {
1583
- // console.log( insertdetail.questionAnswers[0].questions[0] );
1584
- // }
1585
1582
 
1586
1583
  await taskProcessedService.insertMany( insertList );
1587
1584
  logger.info( { function: 'insertPCBulk_v3', query: assigndeletequery } );
@@ -1635,7 +1632,7 @@ export async function uploadImage( req, res ) {
1635
1632
  return res.sendError( { message: 'Something went wrong' }, 500 );
1636
1633
  }
1637
1634
 
1638
- return res.sendSuccess( { message: 'Uploaded Successfully', imgUrl: imgUrl } );
1635
+ return res.sendSuccess( { message: 'Uploaded Successfully', imgUrl: imgUrl, path: imgUrl.Key } );
1639
1636
  } catch ( e ) {
1640
1637
  logger.error( 'uploadImage =>', e );
1641
1638
  return res.sendError( e, 500 );
@@ -2182,7 +2179,7 @@ export async function createChecklistMultiTask( req, res ) {
2182
2179
  };
2183
2180
  let question = {
2184
2181
  checkListId: response?._id,
2185
- question: inputBody.showcomment? inputBody.question:newquestion,
2182
+ question: inputBody.showcomment ? inputBody.question : newquestion,
2186
2183
  section: 'Section 1',
2187
2184
  checkList: inputBody?.checkListName,
2188
2185
  client_id: inputBody.clientId,
@@ -2190,11 +2187,11 @@ export async function createChecklistMultiTask( req, res ) {
2190
2187
  console.log( question );
2191
2188
  await taskQuestionService.create( question );
2192
2189
  for ( let originaldata of inputData ) {
2193
- let findcomment= {};
2190
+ let findcomment = {};
2194
2191
  if ( !inputBody.showcomment ) {
2195
- if ( inputBody?.coverage ==='store' ) {
2192
+ if ( inputBody?.coverage === 'store' ) {
2196
2193
  findcomment = inputBody.excelData.find( ( ele ) => ele.storeName === originaldata.storeName );
2197
- } else if ( inputBody?.coverage==='users' ) {
2194
+ } else if ( inputBody?.coverage === 'users' ) {
2198
2195
  findcomment = inputBody.excelData.find( ( ele ) => ele.userEmail === originaldata.userEmail );
2199
2196
  }
2200
2197
  }
@@ -2245,7 +2242,7 @@ export async function createChecklistMultiTask( req, res ) {
2245
2242
  if ( originaldata?.storeName ) {
2246
2243
  storeDetails = await storeService.findOne( { storeName: originaldata.storeName, status: 'active' }, { storeId: 1, storeProfile: 1 } );
2247
2244
  }
2248
-
2245
+ let findUser = await userService.findOne( { email: originaldata.userEmail } );
2249
2246
  let userDetails = {
2250
2247
  userName: originaldata.userName ? originaldata.userName : '',
2251
2248
  userEmail: originaldata.userEmail ? originaldata.userEmail : '',
@@ -2256,10 +2253,10 @@ export async function createChecklistMultiTask( req, res ) {
2256
2253
  checkListId: response?._id,
2257
2254
  checkListName: data.checkListName,
2258
2255
  client_id: inputBody.clientId,
2259
- userId: userDetailList && userDetailList._id ? userDetailList._id : '',
2260
- assignId: response?.coverage == 'store' ? storeDetails?._id : userDetailList._id,
2256
+ userId: findUser._id ? findUser._id : '',
2257
+ assignId: response?.coverage == 'store' ? storeDetails?._id : findUser._id,
2261
2258
  coverage: response?.coverage || 'store',
2262
- comments: inputBody?.showcomment? inputBody.checkListDescription:findcomment?.comments,
2259
+ comments: inputBody?.showcomment ? inputBody.checkListDescription : findcomment?.comments,
2263
2260
  };
2264
2261
  await taskAssignService.create( userDetails );
2265
2262
  // console.log( originaldata?.checklistId );
@@ -2359,7 +2356,7 @@ export async function approveTask( req, res ) {
2359
2356
  toDate = new Date( toDate.getTime() - userTimezoneOffset );
2360
2357
  toDate.setUTCHours( 23, 59, 59, 59 );
2361
2358
  let query = { sourceCheckList_id: req.body.sourceCheckList_id, date_iso: { $gte: req.body.fromDate, $lte: toDate }, $or: [ { checklistStatus: 'submit' }, { redoStatus: true } ], approvalEnable: true };
2362
- if ( !( req.body.assignedStores && req.body.assignedStores.length >0 ) ) {
2359
+ if ( !( req.body.assignedStores && req.body.assignedStores.length > 0 ) ) {
2363
2360
  req.body.assignedStores = req.body.storeId;
2364
2361
  }
2365
2362
  if ( req.body?.storeId?.length ) {
@@ -2387,13 +2384,13 @@ export async function approveTask( req, res ) {
2387
2384
 
2388
2385
  let teamsMsg;
2389
2386
  let teamsAlertUrls = process.env.teamsAlertURL ? JSON.parse( process.env.teamsAlertURL ) : '';
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;
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;
2391
2388
  if ( teamsAlertUrls && teamsAlertUrls.approvalAlert ) {
2392
2389
  sendTeamsNotification( teamsAlertUrls.approvalAlert, teamsMsg );
2393
2390
  }
2394
2391
 
2395
2392
  if ( updateResponse.modifiedCount || updateResponse.matchedCount ) {
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;
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;
2397
2394
  if ( teamsAlertUrls && teamsAlertUrls.approvalAlert ) {
2398
2395
  sendTeamsNotification( teamsAlertUrls.approvalAlert, teamsMsg );
2399
2396
  }
@@ -3305,7 +3302,7 @@ export async function teamMigrations( req, res ) {
3305
3302
  }
3306
3303
  export async function clusterMigrations( req, res ) {
3307
3304
  try {
3308
- let input =[];
3305
+ let input = [];
3309
3306
  for ( let user of input ) {
3310
3307
  let userexits = await userService.findOne( { 'email': user.clusterEmail, 'clientId': '11' } );
3311
3308
  if ( userexits ) {