tango-app-api-task 3.2.0-beta.5 → 3.2.0-beta.7

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.2.0-beta.5",
3
+ "version": "3.2.0-beta.7",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1468,6 +1468,13 @@ export async function redoTask( req, res ) {
1468
1468
 
1469
1469
  let response = await taskProcessedService.updateOne( { _id: req.body.payload._id }, updateData );
1470
1470
  if ( response.modifiedCount || response.matchedCount ) {
1471
+ let storeTimeZone = await storeService.findOne( { storeName: taskDetails.storeName }, { 'storeProfile.timeZone': 1 } );
1472
+ let currentDateTime;
1473
+ if ( storeTimeZone?.storeProfile?.timeZone ) {
1474
+ currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
1475
+ } else {
1476
+ currentDateTime = dayjs();
1477
+ }
1471
1478
  data = {
1472
1479
  checklistId: taskDetails.sourceCheckList_id,
1473
1480
  checkListName: taskDetails.checkListName,
@@ -1483,7 +1490,7 @@ export async function redoTask( req, res ) {
1483
1490
  type: taskDetails.checkListType,
1484
1491
  userAnswer: userAnswer,
1485
1492
  initiatedBy: req.user.userName,
1486
- initiatedTime: dayjs().format(),
1493
+ initiatedTime: dayjs.utc( currentDateTime.format( 'hh:mm:ss A, DD MMM YYYY' ), 'hh:mm:ss A, DD MMM YYYY' ).format(),
1487
1494
  answerType: question[sectionIndex].questions[req.body.payload.qno - 1].answerType,
1488
1495
  submitedBy: taskDetails.userName,
1489
1496
  submitTime: taskDetails.submitTime,
@@ -15354,13 +15361,10 @@ export async function teamMigrations( req, res ) {
15354
15361
  },
15355
15362
  ],
15356
15363
  };
15357
- console.log( payload );
15358
15364
  const teams = await createTeamsModel( payload );
15359
- console.log( teams );
15360
15365
  } else {
15361
15366
  let userIn = teamsExist.users.filter( ( data ) => data.email === userexits.userName );
15362
15367
  if ( userIn.length==0 ) {
15363
- console.log( '---------------------------', teamsExist.users.length );
15364
15368
  let update = {
15365
15369
  'userName': userexits.userName,
15366
15370
  'email': userexits.email,
@@ -973,14 +973,12 @@ export async function taskDetails( req, res ) {
973
973
  let limit = req.body?.limit || 10;
974
974
  let page = req.body?.offset ? ( req.body.offset * req.body.limit ) : 0;
975
975
  let idList = [];
976
- if ( ( req.body.checklistId && req.body.checklistId != '' ) || ( req.body?.coverage && req.body?.coverage.includes( 'checklist' ) ) ) {
976
+ if ( req.body.coverage.includes( 'checklist' ) ) {
977
977
  let taskQuery;
978
- if ( req.body.checklistId ) {
979
- taskQuery = { referenceCheckListId: { $eq: req.body.checklistId } };
980
- }
981
- if ( req.body?.coverage && req.body.coverage.includes( 'checklist' ) ) {
982
- taskQuery = { referenceCheckListId: { $exists: true } };
983
- }
978
+ taskQuery = {
979
+ referenceCheckListId: { $exists: true },
980
+ ...( req.body.checklistId && req.body.checklistId != '' ) ? { referenceCheckListId: { $eq: req.body.checklistId } } : {},
981
+ };
984
982
  let getChecklistDetails = await taskService.find( taskQuery, { _id: 1 } );
985
983
  if ( getChecklistDetails ) {
986
984
  idList = getChecklistDetails.map( ( item ) => item._id );