tango-app-api-task 3.7.36 → 3.7.37

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.36",
3
+ "version": "3.7.37",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -7109,7 +7109,7 @@ export async function AITaskCreation( req, res ) {
7109
7109
  if ( checklistDetails?.aiConfig?.autoTaskConfig?.taskAssignedTo == 'teams' ) {
7110
7110
  teamDetails = await teamsServices.findteams( { teamName: { $in: checklistDetails?.aiConfig?.autoTaskConfig?.users?.map( ( ele ) => ele.name ) }, clientId: inputBody.clientId }, { users: 1 } );
7111
7111
  if ( teamDetails.length ) {
7112
- inputBody.userEmail.push( ...teamDetails.flatMap( ( team ) => team.users.map( ( user ) => user.email ) ) );
7112
+ inputBody.userEmail.push( ...teamDetails.flatMap( ( team ) => team?.users?.map( ( user ) => user.email ) ), ...teamDetails.flatMap( ( team ) => team?.Teamlead?.map( ( user ) => user.email ) ) );
7113
7113
  }
7114
7114
  }
7115
7115
 
@@ -7252,7 +7252,7 @@ export async function AITaskCreation( req, res ) {
7252
7252
  // Send Push Notification
7253
7253
  // inputBody.approver = inputBody.approver.replace( /,$/, '' );
7254
7254
  let title = `New Task Alert ${inputBody.taskName}-${storeData.storeName}-${dayjs().format( 'YYYY-MM-DD' )}`;
7255
- let time = inputBody?.scheduleEndTime || dayjs().format( 'YYYY-MM-DD' );
7255
+ let time = inputBody?.scheduleEndTime || '11:59 PM';
7256
7256
  let date = inputBody?.scheduleDate || dayjs().format( 'YYYY-MM-DD' );
7257
7257
  let description = `A new task has been assigned to ${storeData.storeName}. Please complete it before the due date of ${date}.`;
7258
7258
  await Promise.all( finduser.map( async ( ele ) => {
@@ -7359,7 +7359,7 @@ export async function AITaskCreation( req, res ) {
7359
7359
  storeCount: 1,
7360
7360
  scheduleDate: date,
7361
7361
  scheduleEndTime: time,
7362
- scheduleEndTimeISO: scheduleEndData,
7362
+ scheduleEndTimeISO: inputBody['scheduleEndData'],
7363
7363
  priorityType: 'high',
7364
7364
  client_id: inputBody.clientId,
7365
7365
  checkListType: 'task',
@@ -7570,10 +7570,10 @@ async function insertAItaskProcessedTaskCreation( checkTask, inputBody, date, ti
7570
7570
  delete oldData.startMobileTime;
7571
7571
  oldData.date_iso = new Date( dayjs( date, 'YYYY-MM-DD' ).format( 'YYYY-MM-DD' ) );
7572
7572
  oldData.date_string = dayjs( date ).format( 'YYYY-MM-DD' );
7573
- oldData.scheduleStartTime_iso = date;
7573
+ oldData.scheduleStartTime_iso = inputBody?.scheduleEndTime ?dayjs.utc( inputBody?.scheduleEndTime, 'hh:mm A' ).format() : date;
7574
7574
  oldData.scheduleEndTime_iso = dayjs.utc( inputBody.scheduleEndData, 'YYYY-MM-DD hh:mm A' ).format();
7575
7575
  oldData.scheduleEndTime = dayjs.utc( inputBody.scheduleEndData, 'YYYY-MM-DD hh:mm A' ).format( 'hh:mm A' );
7576
- oldData.scheduleStartTime = dayjs.utc().format( 'hh:mm A' );
7576
+ oldData.scheduleStartTime = inputBody?.scheduleEndTime ?? dayjs.utc().format( 'hh:mm A' );
7577
7577
  oldData.store_id = storeDetails.storeId;
7578
7578
  oldData.storeName = storeDetails.storeName;
7579
7579
  oldData.country = storeDetails.storeProfile.country;