tango-app-api-task 1.0.0-alpha.17 → 1.0.0-alpha.19

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": "1.0.0-alpha.17",
3
+ "version": "1.0.0-alpha.19",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -174,7 +174,7 @@ export async function createUpdateTask( req, res ) {
174
174
  return res.sendError( { message: 'something went wrong' }, 500 );
175
175
  }
176
176
  } catch ( e ) {
177
- logger.error( { functionName: 'createTask', error: e } );
177
+ logger.error( { functionName: 'createTask', error: e, message: req.body } );
178
178
  return res.sendError( e, 500 );
179
179
  }
180
180
  }
@@ -558,7 +558,7 @@ async function uploadUser( req, res ) {
558
558
  }
559
559
  }
560
560
  } catch ( e ) {
561
- logger.error( { functionName: 'upload User', error: e } );
561
+ logger.error( { functionName: 'upload User', error: e, message: req.body } );
562
562
  return res.sendError( e, 500 );
563
563
  }
564
564
  }
@@ -616,7 +616,7 @@ export async function userDetails( req, res ) {
616
616
  } );
617
617
  return res.sendSuccess( { users: userDetails, count: taskDetails[0].count[0].total } );
618
618
  } catch ( e ) {
619
- logger.error( { functionName: 'userDetails', error: e } );
619
+ logger.error( { functionName: 'userDetails', error: e, message: req.body } );
620
620
  return res.sendError( e, 500 );
621
621
  }
622
622
  };
@@ -640,7 +640,7 @@ export async function taskConfig( req, res ) {
640
640
  }
641
641
 
642
642
  let logInsertData = {
643
- action: inputBody.submitType == 'publish' ? 'checklistPublishUsingConfigPage' : 'checklistConfigDraft',
643
+ action: inputBody.submitType == 'publish' ? 'taskPublishUsingConfigPage' : 'taskConfigDraft',
644
644
  checklistId: inputBody._id,
645
645
  checkListName: inputBody?.checkListName,
646
646
  createdBy: req.user._id,
@@ -656,7 +656,8 @@ export async function taskConfig( req, res ) {
656
656
  }
657
657
 
658
658
  let configDetails = { ...req.body };
659
- configDetails.scheduleEndTimeISO = dayjs.utc( configDetails.scheduleEndTime, 'hh:mm A' ).format();
659
+ let endDate = dayjs.utc( configDetails?.scheduleDate ).format( 'YYYY-MM-DD' ) + ' ' + configDetails.scheduleEndTime;
660
+ configDetails.scheduleEndTimeISO = dayjs.utc( endDate, 'YYYY-MM-DD hh:mm A' ).format();
660
661
  configDetails.publishDate = dayjs().format();
661
662
 
662
663
  let response = await taskService.updateOne( { _id: inputBody._id }, configDetails );
@@ -716,10 +717,9 @@ export async function taskConfig( req, res ) {
716
717
  }
717
718
  await taskService.updateOne( { _id: inputBody._id }, { storeCount, locationCount } );
718
719
  if ( inputBody.submitType == 'publish' ) {
719
- let currentDate = dayjs.utc().format();
720
- let updatedscheduleEndTimeISO = dayjs.utc( checklistDetails?.scheduleDate ).format( 'YYYY-MM-DD' ) + ' ' + checklistDetails.scheduleEndTime;
721
- updatedscheduleEndTimeISO = dayjs.utc( updatedscheduleEndTimeISO, 'YYYY-MM-DD hh:mm A' ).format();
722
- if ( updatedscheduleEndTimeISO >= currentDate ) {
720
+ let tDate = dayjs().format( 'YYYY-MM-DD' ) + ' ' + dayjs().format( 'hh:mm A' );
721
+ let currentDate = dayjs( tDate, 'YYYY-MM-DD hh:mm A' ).format();
722
+ if ( configDetails.scheduleEndTimeISO >= currentDate ) {
723
723
  let deleteQuery = {
724
724
  $and: [
725
725
  { date_string: dayjs().format( 'YYYY-MM-DD' ) },
@@ -745,7 +745,7 @@ export async function taskConfig( req, res ) {
745
745
  }
746
746
  }
747
747
  } catch ( e ) {
748
- logger.error( { functionName: 'updateConfigure =>', error: e } );
748
+ logger.error( { functionName: 'updateConfigure =>', error: e, message: req.body } );
749
749
  return res.sendError( e, 500 );
750
750
  }
751
751
  }
@@ -832,7 +832,7 @@ export async function insertSingleProcessData( checklistId ) {
832
832
  }
833
833
  return true;
834
834
  } catch ( error ) {
835
- logger.error( 'PCLchecklistCreationValidator error =>', error );
835
+ logger.error( { function: 'PCLchecklistCreationValidator error =>', error: error } );
836
836
  return false;
837
837
  }
838
838
  };
@@ -1156,7 +1156,7 @@ export async function createChecklistTask( req, res ) {
1156
1156
  return res.sendSuccess( 'Task created successfully' );
1157
1157
  }
1158
1158
  } catch ( e ) {
1159
- logger.error( { functionName: 'createChecklistTask', error: e } );
1159
+ logger.error( { functionName: 'createChecklistTask', error: e, message: req.body } );
1160
1160
  return res.sendError( e, 500 );
1161
1161
  }
1162
1162
  }
@@ -1206,7 +1206,7 @@ export async function approveTask( req, res ) {
1206
1206
  }
1207
1207
  }
1208
1208
  } catch ( e ) {
1209
- logger.error( { function: 'approveTask', error: e } );
1209
+ logger.error( { function: 'approveTask', error: e, message: req.body } );
1210
1210
  return res.sendError( e, 500 );
1211
1211
  }
1212
1212
  }
@@ -1278,7 +1278,7 @@ export async function redoTask( req, res ) {
1278
1278
  return res.sendError( 'Something went wrong', 500 );
1279
1279
  }
1280
1280
  } catch ( e ) {
1281
- logger.error( { function: 'redoChecklist', error: e } );
1281
+ logger.error( { function: 'redoChecklist', error: e, message: req.body } );
1282
1282
  return res.sendError( e, 500 );
1283
1283
  }
1284
1284
  }
@@ -291,6 +291,8 @@ export const activityLogV1 = async ( req, res ) => {
291
291
  action: 1,
292
292
  createdAt: 1,
293
293
  type: 1,
294
+ store_id: 1,
295
+ checklistId: 1,
294
296
  },
295
297
  } );
296
298
  findQuery.push( { $sort: { ['_id']: -1 } } );