tango-app-api-task 3.7.36 → 3.7.38
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
|
@@ -7093,10 +7093,7 @@ export async function AITaskCreation( req, res ) {
|
|
|
7093
7093
|
|
|
7094
7094
|
let checklistDetails = await checklistService.findOne( { checkListType: req.body.aiType, publish: true, client_id: req.body.clientId }, { aiConfig: 1 } );
|
|
7095
7095
|
|
|
7096
|
-
if ( !checklistDetails?.aiConfig?.autoTaskConfig?.enabled ) {
|
|
7097
|
-
return res.sendError( 'No data found', 204 );
|
|
7098
|
-
}
|
|
7099
|
-
if ( !checklistDetails ) {
|
|
7096
|
+
if ( !checklistDetails || !checklistDetails?.aiConfig?.autoTaskConfig?.enabled ) {
|
|
7100
7097
|
return res.sendError( 'No data found', 204 );
|
|
7101
7098
|
}
|
|
7102
7099
|
// Step:1 Store Validation
|
|
@@ -7109,7 +7106,7 @@ export async function AITaskCreation( req, res ) {
|
|
|
7109
7106
|
if ( checklistDetails?.aiConfig?.autoTaskConfig?.taskAssignedTo == 'teams' ) {
|
|
7110
7107
|
teamDetails = await teamsServices.findteams( { teamName: { $in: checklistDetails?.aiConfig?.autoTaskConfig?.users?.map( ( ele ) => ele.name ) }, clientId: inputBody.clientId }, { users: 1 } );
|
|
7111
7108
|
if ( teamDetails.length ) {
|
|
7112
|
-
inputBody.userEmail.push( ...teamDetails.flatMap( ( team ) => team
|
|
7109
|
+
inputBody.userEmail.push( ...teamDetails.flatMap( ( team ) => team?.users?.map( ( user ) => user.email ) ), ...teamDetails.flatMap( ( team ) => team?.Teamlead?.map( ( user ) => user.email ) ) );
|
|
7113
7110
|
}
|
|
7114
7111
|
}
|
|
7115
7112
|
|
|
@@ -7252,7 +7249,7 @@ export async function AITaskCreation( req, res ) {
|
|
|
7252
7249
|
// Send Push Notification
|
|
7253
7250
|
// inputBody.approver = inputBody.approver.replace( /,$/, '' );
|
|
7254
7251
|
let title = `New Task Alert ${inputBody.taskName}-${storeData.storeName}-${dayjs().format( 'YYYY-MM-DD' )}`;
|
|
7255
|
-
let time = inputBody?.scheduleEndTime ||
|
|
7252
|
+
let time = inputBody?.scheduleEndTime || '11:59 PM';
|
|
7256
7253
|
let date = inputBody?.scheduleDate || dayjs().format( 'YYYY-MM-DD' );
|
|
7257
7254
|
let description = `A new task has been assigned to ${storeData.storeName}. Please complete it before the due date of ${date}.`;
|
|
7258
7255
|
await Promise.all( finduser.map( async ( ele ) => {
|
|
@@ -7359,7 +7356,7 @@ export async function AITaskCreation( req, res ) {
|
|
|
7359
7356
|
storeCount: 1,
|
|
7360
7357
|
scheduleDate: date,
|
|
7361
7358
|
scheduleEndTime: time,
|
|
7362
|
-
scheduleEndTimeISO: scheduleEndData,
|
|
7359
|
+
scheduleEndTimeISO: inputBody['scheduleEndData'],
|
|
7363
7360
|
priorityType: 'high',
|
|
7364
7361
|
client_id: inputBody.clientId,
|
|
7365
7362
|
checkListType: 'task',
|
|
@@ -7570,10 +7567,10 @@ async function insertAItaskProcessedTaskCreation( checkTask, inputBody, date, ti
|
|
|
7570
7567
|
delete oldData.startMobileTime;
|
|
7571
7568
|
oldData.date_iso = new Date( dayjs( date, 'YYYY-MM-DD' ).format( 'YYYY-MM-DD' ) );
|
|
7572
7569
|
oldData.date_string = dayjs( date ).format( 'YYYY-MM-DD' );
|
|
7573
|
-
oldData.scheduleStartTime_iso = date;
|
|
7570
|
+
oldData.scheduleStartTime_iso = inputBody?.scheduleEndTime ?dayjs.utc( inputBody?.scheduleEndTime, 'hh:mm A' ).format() : date;
|
|
7574
7571
|
oldData.scheduleEndTime_iso = dayjs.utc( inputBody.scheduleEndData, 'YYYY-MM-DD hh:mm A' ).format();
|
|
7575
7572
|
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' );
|
|
7573
|
+
oldData.scheduleStartTime = inputBody?.scheduleEndTime ?? dayjs.utc().format( 'hh:mm A' );
|
|
7577
7574
|
oldData.store_id = storeDetails.storeId;
|
|
7578
7575
|
oldData.storeName = storeDetails.storeName;
|
|
7579
7576
|
oldData.country = storeDetails.storeProfile.country;
|