tango-app-api-task 3.7.39 → 3.7.41

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.39",
3
+ "version": "3.7.41",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -7249,7 +7249,7 @@ export async function AITaskCreation( req, res ) {
7249
7249
  // Send Push Notification
7250
7250
  // inputBody.approver = inputBody.approver.replace( /,$/, '' );
7251
7251
  let title = `New Task Alert ${inputBody.taskName}-${storeData.storeName}-${dayjs().format( 'YYYY-MM-DD' )}`;
7252
- let time = inputBody?.scheduleEndTime || '11:59 PM';
7252
+ let time = inputBody?.scheduleEndTime ? dayjs( inputBody?.scheduleEndTime, 'hh:mm A' ).format( 'HH:mm' ) :'23:59';
7253
7253
  let date = inputBody?.scheduleDate || dayjs().format( 'YYYY-MM-DD' );
7254
7254
  let description = `A new task has been assigned to ${storeData.storeName}. Please complete it before the due date of ${date}.`;
7255
7255
  await Promise.all( finduser.map( async ( ele ) => {
@@ -7258,19 +7258,18 @@ export async function AITaskCreation( req, res ) {
7258
7258
  sendPushNotification( title, description, fcmToken );
7259
7259
  }
7260
7260
  } ) );
7261
-
7262
- inputBody['scheduleEndData'] = dayjs.utc( `${date} ${time}`, 'YYYY-MM-DD hh:mm A' ).format();
7261
+ // inputBody['scheduleEndData'] = dayjs.utc( `${date} ${time}`, 'YYYY-MM-DD HH:mm' ).format();
7263
7262
  if ( checklistDetails?.aiConfig?.autoTaskConfig.taskValidity?.type == 'mins' ) {
7264
- inputBody['scheduleEndData'] = dayjs.utc( `${date} ${time}`, 'YYYY-MM-DD hh:mm A' ).add( checklistDetails?.aiConfig?.autoTaskConfig.taskValidity.time, 'minute' ).format();
7263
+ inputBody['scheduleEndData'] = dayjs.utc( `${date} ${time}`, 'YYYY-MM-DD HH:mm' ).add( checklistDetails?.aiConfig?.autoTaskConfig.taskValidity.time, 'minute' ).format();
7265
7264
  }
7266
7265
  if ( checklistDetails?.aiConfig?.autoTaskConfig.taskValidity?.type == 'hours' ) {
7267
- inputBody['scheduleEndData'] = dayjs.utc( `${date} ${time}`, 'YYYY-MM-DD hh:mm A' ).add( checklistDetails?.aiConfig?.autoTaskConfig.taskValidity.time, 'hour' ).format();
7266
+ inputBody['scheduleEndData'] = dayjs.utc( `${date} ${time}`, 'YYYY-MM-DD HH:mm' ).add( checklistDetails?.aiConfig?.autoTaskConfig.taskValidity.time, 'hour' ).format();
7268
7267
  }
7269
7268
  if ( checklistDetails?.aiConfig?.autoTaskConfig.taskValidity?.type == 'days' ) {
7270
- inputBody['scheduleEndData'] = dayjs.utc( `${date} ${time}`, 'YYYY-MM-DD hh:mm A' ).add( checklistDetails?.aiConfig?.autoTaskConfig.taskValidity.time, 'day' ).format();
7269
+ inputBody['scheduleEndData'] = dayjs.utc( `${date} ${time}`, 'YYYY-MM-DD HH:mm' ).add( checklistDetails?.aiConfig?.autoTaskConfig.taskValidity.time, 'day' ).format();
7271
7270
  }
7272
7271
 
7273
- const inputDateTime = dayjs.utc( `${date} ${time}`, 'YYYY-MM-DD hh:mm A' );
7272
+ const inputDateTime = dayjs.utc( `${date} ${time}`, 'YYYY-MM-DD HH:mm' );
7274
7273
  const currentTime = dayjs.utc();
7275
7274
  if ( inputDateTime.isBefore( currentTime ) ) {
7276
7275
  return res.sendError( 'The input date-time is before the current time.', 500 );
@@ -7336,7 +7335,7 @@ export async function AITaskCreation( req, res ) {
7336
7335
  }
7337
7336
 
7338
7337
  // Check this Task Already Exist////
7339
- let checkTask = await taskService.findOne( { checkListName: inputBody.taskName } );
7338
+ let checkTask = await taskService.findOne( { checkListName: inputBody.taskName, client_id: req.body.clientId } );
7340
7339
  if ( checkTask ) {
7341
7340
  let singleInsert = await insertAItaskProcessedTaskCreation( checkTask, inputBody, date, time, storeData, finduser, answer, userAdmin );
7342
7341
  if ( singleInsert ) {
@@ -7566,11 +7565,11 @@ async function insertAItaskProcessedTaskCreation( checkTask, inputBody, date, ti
7566
7565
  delete oldData.submitMobileTime;
7567
7566
  delete oldData.startMobileTime;
7568
7567
  oldData.date_iso = new Date( dayjs( date, 'YYYY-MM-DD' ).format( 'YYYY-MM-DD' ) );
7569
- oldData.date_string = dayjs( date ).format( 'YYYY-MM-DD' );
7568
+ oldData.date_string = date;
7570
7569
  oldData.scheduleStartTime_iso = inputBody?.scheduleEndTime ?dayjs.utc( inputBody?.scheduleEndTime, 'hh:mm A' ).format() : date;
7571
- oldData.scheduleEndTime_iso = dayjs.utc( inputBody.scheduleEndData, 'YYYY-MM-DD hh:mm A' ).format();
7572
- oldData.scheduleEndTime = dayjs.utc( inputBody.scheduleEndData, 'YYYY-MM-DD hh:mm A' ).format( 'hh:mm A' );
7573
- oldData.scheduleStartTime = inputBody?.scheduleEndTime ?? dayjs.utc().format( 'hh:mm A' );
7570
+ oldData.scheduleEndTime_iso = dayjs.utc( inputBody.scheduleEndData ).format();
7571
+ oldData.scheduleEndTime = dayjs.utc( inputBody.scheduleEndData ).format( 'hh:mm A' );
7572
+ oldData.scheduleStartTime = inputBody?.scheduleEndTime ?? dayjs.format( 'hh:mm A' );
7574
7573
  oldData.store_id = storeDetails.storeId;
7575
7574
  oldData.storeName = storeDetails.storeName;
7576
7575
  oldData.country = storeDetails.storeProfile.country;