tango-app-api-task 3.3.1-beta-9 → 3.3.1-hotfix-2
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
|
@@ -126,7 +126,7 @@ async function insertData( requestData ) {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
console.log( resultchecklist );
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
if ( resultchecklist.length ) {
|
|
@@ -141,7 +141,7 @@ async function insertData( requestData ) {
|
|
|
141
141
|
let startTimeIso; let endTimeIso;
|
|
142
142
|
startTimeIso = dayjs.utc( `${currentdate} ${sTime}`, 'YYYY-MM-DD hh:mm A' );
|
|
143
143
|
endTimeIso = dayjs.utc( getCLconfig.scheduleEndTimeISO );
|
|
144
|
-
|
|
144
|
+
console.log( endTimeIso );
|
|
145
145
|
|
|
146
146
|
let insertdata = {};
|
|
147
147
|
insertdata.date_iso = new Date( dayjs( currentdate, 'YYYY-MM-DD' ).format( 'YYYY-MM-DD' ) );
|
|
@@ -269,7 +269,7 @@ async function insertData( requestData ) {
|
|
|
269
269
|
if ( userIdList.length ) {
|
|
270
270
|
allQuestion = allQuestion.filter( ( item ) => typeof item._id == 'undefined' );
|
|
271
271
|
}
|
|
272
|
-
|
|
272
|
+
console.log( allQuestion );
|
|
273
273
|
|
|
274
274
|
if ( allQuestion ) {
|
|
275
275
|
let assigndeletequery = {};
|
|
@@ -963,7 +963,7 @@ export async function taskConfig( req, res ) {
|
|
|
963
963
|
return res.sendSuccess( { id: inputBody._id, message: message } );
|
|
964
964
|
}
|
|
965
965
|
} catch ( e ) {
|
|
966
|
-
|
|
966
|
+
console.log( 'e', e );
|
|
967
967
|
logger.error( { functionName: 'taskConfig =>', error: e, message: req.body } );
|
|
968
968
|
return res.sendError( e, 500 );
|
|
969
969
|
}
|
|
@@ -1357,7 +1357,7 @@ export async function uploadImage( req, res ) {
|
|
|
1357
1357
|
|
|
1358
1358
|
async function createUser( data ) {
|
|
1359
1359
|
try {
|
|
1360
|
-
|
|
1360
|
+
console.log( 'createUser ====>', data );
|
|
1361
1361
|
let params = {
|
|
1362
1362
|
userName: data.userName,
|
|
1363
1363
|
email: data.email,
|
|
@@ -1825,7 +1825,7 @@ export async function redoTask( req, res ) {
|
|
|
1825
1825
|
};
|
|
1826
1826
|
|
|
1827
1827
|
let response = await taskProcessedService.updateOne( { _id: req.body.payload._id }, updateData );
|
|
1828
|
-
|
|
1828
|
+
console.log( response );
|
|
1829
1829
|
if ( response.modifiedCount || response.matchedCount ) {
|
|
1830
1830
|
let storeTimeZone = await storeService.findOne( { storeName: taskDetails.storeName }, { 'storeProfile.timeZone': 1 } );
|
|
1831
1831
|
let currentDateTime;
|
|
@@ -1865,7 +1865,7 @@ export async function redoTask( req, res ) {
|
|
|
1865
1865
|
};
|
|
1866
1866
|
let url = JSON.parse( process.env.LAMBDAURL );
|
|
1867
1867
|
let searchResponse = await fetch( url.redoTask, requestOptions );
|
|
1868
|
-
|
|
1868
|
+
console.log( searchResponse.ok );
|
|
1869
1869
|
if ( searchResponse.ok ) {
|
|
1870
1870
|
return res.sendSuccess( 'Question redo successfully' );
|
|
1871
1871
|
} else {
|
|
@@ -3714,7 +3714,7 @@ export async function updateAssign( req, res ) {
|
|
|
3714
3714
|
let userData = {
|
|
3715
3715
|
userName: assign.userName,
|
|
3716
3716
|
email: assign.userEmail,
|
|
3717
|
-
mobileNumber: assign?.
|
|
3717
|
+
mobileNumber: assign?.phone || '',
|
|
3718
3718
|
clientId: req.body.clientId,
|
|
3719
3719
|
};
|
|
3720
3720
|
userDetails = await createUser( userData );
|
|
@@ -3979,7 +3979,7 @@ export async function taskcreation( req, res ) {
|
|
|
3979
3979
|
|
|
3980
3980
|
|
|
3981
3981
|
let finduser = await userService.findOne( { clientId: inputBody.clientId, email: req.body.user, userType: 'client', isActive: true }, { userName: '$userName', email: 1, userId: '$_id' } );
|
|
3982
|
-
|
|
3982
|
+
console.log( finduser );
|
|
3983
3983
|
|
|
3984
3984
|
if ( !finduser ) {
|
|
3985
3985
|
return res.sendError( 'No user Found', 500 );
|
|
@@ -4039,35 +4039,7 @@ export async function taskcreation( req, res ) {
|
|
|
4039
4039
|
...( inputBody?.checkListId ) ? { referenceCheckListId: inputBody?.checkListId } : {},
|
|
4040
4040
|
};
|
|
4041
4041
|
data['approver'] = userAdmin;
|
|
4042
|
-
|
|
4043
|
-
if ( answer.length == 0 ) {
|
|
4044
|
-
return res.sendError( 'please enter Valid AnswerType', 500 );
|
|
4045
|
-
}
|
|
4046
|
-
if ( inputBody?.answerType === 'multiplechoicesingle' || inputBody?.answerType === 'multiplechoicemultiple' ) {
|
|
4047
|
-
if ( inputBody?.options && inputBody?.options.length > 1 ) {
|
|
4048
|
-
let optionsResult = [];
|
|
4049
|
-
for ( let option of inputBody?.options ) {
|
|
4050
|
-
let optiondata = {
|
|
4051
|
-
'answer': '',
|
|
4052
|
-
'sopFlag': false,
|
|
4053
|
-
'validation': false,
|
|
4054
|
-
'validationType': '',
|
|
4055
|
-
'referenceImage': [],
|
|
4056
|
-
'runAI': false,
|
|
4057
|
-
'allowUploadfromGallery': false,
|
|
4058
|
-
'descriptivetype': '',
|
|
4059
|
-
'showLinked': false,
|
|
4060
|
-
'linkedQuestion': 0,
|
|
4061
|
-
'nestedQuestion': [],
|
|
4062
|
-
};
|
|
4063
|
-
optiondata.answer = option;
|
|
4064
|
-
optionsResult.push( optiondata );
|
|
4065
|
-
}
|
|
4066
|
-
answer = optionsResult;
|
|
4067
|
-
} else {
|
|
4068
|
-
return res.sendError( 'please enter Valid Options', 500 );
|
|
4069
|
-
}
|
|
4070
|
-
}
|
|
4042
|
+
|
|
4071
4043
|
let response = await taskService.create( data );
|
|
4072
4044
|
if ( response?.approver.length ) {
|
|
4073
4045
|
let inputData = [];
|
|
@@ -4083,11 +4055,41 @@ export async function taskcreation( req, res ) {
|
|
|
4083
4055
|
await traxApprover.insertMany( inputData );
|
|
4084
4056
|
}
|
|
4085
4057
|
if ( response?._id ) {
|
|
4086
|
-
let question = [
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
'
|
|
4058
|
+
let question = [];
|
|
4059
|
+
for ( let [ index, ques ] of inputBody.questions.entries() ) {
|
|
4060
|
+
let answer = await findAnswer( ques?.answerType );
|
|
4061
|
+
if ( answer.length == 0 ) {
|
|
4062
|
+
return res.sendError( 'please enter Valid AnswerType', 500 );
|
|
4063
|
+
}
|
|
4064
|
+
if ( ques?.answerType === 'multiplechoicesingle' || ques?.answerType === 'multiplechoicemultiple' ) {
|
|
4065
|
+
if ( ques?.options && ques?.options.length > 1 ) {
|
|
4066
|
+
let optionsResult = [];
|
|
4067
|
+
for ( let option of ques?.options ) {
|
|
4068
|
+
let optiondata = {
|
|
4069
|
+
'answer': '',
|
|
4070
|
+
'sopFlag': false,
|
|
4071
|
+
'validation': false,
|
|
4072
|
+
'validationType': '',
|
|
4073
|
+
'referenceImage': [],
|
|
4074
|
+
'runAI': false,
|
|
4075
|
+
'allowUploadfromGallery': false,
|
|
4076
|
+
'descriptivetype': '',
|
|
4077
|
+
'showLinked': false,
|
|
4078
|
+
'linkedQuestion': 0,
|
|
4079
|
+
'nestedQuestion': [],
|
|
4080
|
+
};
|
|
4081
|
+
optiondata.answer = String( option );
|
|
4082
|
+
optionsResult.push( optiondata );
|
|
4083
|
+
}
|
|
4084
|
+
answer = optionsResult;
|
|
4085
|
+
} else {
|
|
4086
|
+
return res.sendError( 'please enter Valid Options', 500 );
|
|
4087
|
+
}
|
|
4088
|
+
}
|
|
4089
|
+
question.push( {
|
|
4090
|
+
'qno': index+1,
|
|
4091
|
+
'qname': ques.question,
|
|
4092
|
+
'answerType': ques?.answerType || 'yes/no',
|
|
4091
4093
|
'runAI': false,
|
|
4092
4094
|
'runAIDescription': '',
|
|
4093
4095
|
'allowUploadfromGallery': false,
|
|
@@ -4095,9 +4097,9 @@ export async function taskcreation( req, res ) {
|
|
|
4095
4097
|
'questionReferenceImage': [],
|
|
4096
4098
|
'answers': answer,
|
|
4097
4099
|
'descriptivetype': 'text',
|
|
4098
|
-
}
|
|
4099
|
-
|
|
4100
|
-
let images = [];
|
|
4100
|
+
} );
|
|
4101
|
+
}
|
|
4102
|
+
// let images = [];
|
|
4101
4103
|
|
|
4102
4104
|
// for ( let imgpath of req.body.referenceImage ) {
|
|
4103
4105
|
// let configURL = JSON.parse( process.env.BUCKET );
|
|
@@ -4122,12 +4124,11 @@ export async function taskcreation( req, res ) {
|
|
|
4122
4124
|
// }
|
|
4123
4125
|
// images.push( url.join( '/' ) );
|
|
4124
4126
|
// }
|
|
4125
|
-
question[0].questionReferenceImage = images;
|
|
4126
|
-
|
|
4127
|
-
if ( inputBody?.answerType === 'image' || inputBody?.answerType === 'descriptiveImage' || inputBody?.answerType === 'multipleImage' ) {
|
|
4128
|
-
answer[0].referenceImage = question[0].questionReferenceImage;
|
|
4129
|
-
}
|
|
4127
|
+
// question[0].questionReferenceImage = images;
|
|
4130
4128
|
|
|
4129
|
+
// if ( inputBody?.answerType === 'image' || inputBody?.answerType === 'descriptiveImage' || inputBody?.answerType === 'multipleImage' ) {
|
|
4130
|
+
// answer[0].referenceImage = question[0].questionReferenceImage;
|
|
4131
|
+
// }
|
|
4131
4132
|
|
|
4132
4133
|
question = {
|
|
4133
4134
|
checkListId: response?._id,
|
|
@@ -88,7 +88,7 @@ export const overallCardsV1 = async ( req, res ) => {
|
|
|
88
88
|
resultData = { taskApproval: { count: taskCount?.[0]?.count || 0 }, checklistApproval: { count: checklistCount?.[0]?.count || 0 } };
|
|
89
89
|
return res.sendSuccess( { cardData: resultData } );
|
|
90
90
|
} catch ( error ) {
|
|
91
|
-
|
|
91
|
+
console.log( 'error =>', error );
|
|
92
92
|
logger.error( { error: error, function: 'overallCards' } );
|
|
93
93
|
return res.sendError( error, 500 );
|
|
94
94
|
}
|
|
@@ -160,7 +160,6 @@ export const approvalTableV1 = async ( req, res ) => {
|
|
|
160
160
|
},
|
|
161
161
|
},
|
|
162
162
|
coverage: { $first: '$coverage' },
|
|
163
|
-
userName: { $first: '$userName' },
|
|
164
163
|
},
|
|
165
164
|
},
|
|
166
165
|
{
|
|
@@ -180,7 +179,6 @@ export const approvalTableV1 = async ( req, res ) => {
|
|
|
180
179
|
storeName: 1,
|
|
181
180
|
redo: '$_id.redoType',
|
|
182
181
|
coverage: 1,
|
|
183
|
-
userName: 1,
|
|
184
182
|
},
|
|
185
183
|
},
|
|
186
184
|
{
|
|
@@ -366,7 +364,7 @@ export const overallCards = async ( req, res ) => {
|
|
|
366
364
|
let resultData = await overallCardsData( requestData );
|
|
367
365
|
return res.sendSuccess( resultData );
|
|
368
366
|
} catch ( error ) {
|
|
369
|
-
|
|
367
|
+
console.log( 'error =>', error );
|
|
370
368
|
logger.error( { error: error, function: 'overallCards' } );
|
|
371
369
|
return res.sendError( error, 500 );
|
|
372
370
|
}
|
|
@@ -385,7 +383,7 @@ async function overallCardsData( requestData ) {
|
|
|
385
383
|
// resultData.card = cardData;
|
|
386
384
|
return { cardData: cardData };
|
|
387
385
|
} catch ( error ) {
|
|
388
|
-
|
|
386
|
+
console.log( 'error =>', error );
|
|
389
387
|
logger.error( { error: error, message: data, function: 'overallCardsData' } );
|
|
390
388
|
}
|
|
391
389
|
}
|
|
@@ -396,7 +394,7 @@ export const approvalTable = async ( req, res ) => {
|
|
|
396
394
|
let resultData = await approvalTableData( requestData );
|
|
397
395
|
return res.sendSuccess( resultData );
|
|
398
396
|
} catch ( error ) {
|
|
399
|
-
|
|
397
|
+
console.log( 'error =>', error );
|
|
400
398
|
logger.error( { error: error, function: 'taskTable' } );
|
|
401
399
|
return res.sendError( error, 500 );
|
|
402
400
|
}
|
|
@@ -463,7 +461,7 @@ async function approvalTableData( requestData ) {
|
|
|
463
461
|
};
|
|
464
462
|
return tableData;
|
|
465
463
|
} catch ( error ) {
|
|
466
|
-
|
|
464
|
+
console.log( 'error =>', error );
|
|
467
465
|
logger.error( { error: error, message: requestData, function: 'approvalTableData' } );
|
|
468
466
|
return res.sendError( error, 500 );
|
|
469
467
|
}
|
|
@@ -475,7 +473,7 @@ export const activityLog = async ( req, res ) => {
|
|
|
475
473
|
let resultData = await activityLogData( requestData );
|
|
476
474
|
return res.sendSuccess( resultData );
|
|
477
475
|
} catch ( error ) {
|
|
478
|
-
|
|
476
|
+
console.log( 'error =>', error );
|
|
479
477
|
logger.error( { error: error, function: 'activityLog' } );
|
|
480
478
|
return res.sendError( error, 500 );
|
|
481
479
|
}
|
|
@@ -538,7 +536,7 @@ async function activityLogData( requestData ) {
|
|
|
538
536
|
};
|
|
539
537
|
return activityLogData;
|
|
540
538
|
} catch ( error ) {
|
|
541
|
-
|
|
539
|
+
console.log( 'error =>', error );
|
|
542
540
|
logger.error( { error: error, message: requestData, function: 'activityLogData' } );
|
|
543
541
|
return res.sendError( error, 500 );
|
|
544
542
|
}
|
|
@@ -11,7 +11,7 @@ export const overallCards = async ( req, res ) => {
|
|
|
11
11
|
let resultData = await overallCardsData( requestData );
|
|
12
12
|
return res.sendSuccess( resultData );
|
|
13
13
|
} catch ( error ) {
|
|
14
|
-
|
|
14
|
+
console.log( 'error =>', error );
|
|
15
15
|
logger.error( { error: error, function: 'overallCards' } );
|
|
16
16
|
return res.sendError( error, 500 );
|
|
17
17
|
}
|
|
@@ -42,7 +42,7 @@ async function overallCardsData( requestData ) {
|
|
|
42
42
|
// resultData.card = cardData;
|
|
43
43
|
return { cardData: cardData };
|
|
44
44
|
} catch ( error ) {
|
|
45
|
-
|
|
45
|
+
console.log( 'error =>', error );
|
|
46
46
|
logger.error( { error: error, message: data, function: 'overallCardsData' } );
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -108,6 +108,7 @@ export const overallCardsV1 = async ( req, res ) => {
|
|
|
108
108
|
};
|
|
109
109
|
export const taskTableV1 = async ( req, res ) => {
|
|
110
110
|
try {
|
|
111
|
+
console.log( 'req.body', req.body );
|
|
111
112
|
let limit = parseInt( req.body.limit ) || 10;
|
|
112
113
|
let offset = parseInt( req.body.offset - 1 ) || 0;
|
|
113
114
|
let page = offset * limit;
|
|
@@ -189,7 +190,7 @@ export const taskTableV1 = async ( req, res ) => {
|
|
|
189
190
|
{ $sort: { createdAt: -1 } },
|
|
190
191
|
);
|
|
191
192
|
}
|
|
192
|
-
|
|
193
|
+
console.log( 'page', page );
|
|
193
194
|
query.push( {
|
|
194
195
|
$facet: {
|
|
195
196
|
data: [
|
|
@@ -220,7 +221,7 @@ export const taskTableV1 = async ( req, res ) => {
|
|
|
220
221
|
|
|
221
222
|
return res.sendSuccess( { taskTableData: checkList[0].data, totalCount: checkList[0].count[0].totalCount } );
|
|
222
223
|
} catch ( e ) {
|
|
223
|
-
|
|
224
|
+
console.log( 'e', e );
|
|
224
225
|
logger.error( 'checklist =>', e );
|
|
225
226
|
return res.sendError( e, 500 );
|
|
226
227
|
}
|
|
@@ -421,7 +422,7 @@ export const taskInfoTableV1 = async ( req, res ) => {
|
|
|
421
422
|
}
|
|
422
423
|
return res.sendSuccess( result );
|
|
423
424
|
} catch ( error ) {
|
|
424
|
-
|
|
425
|
+
console.log( 'error =>', error );
|
|
425
426
|
logger.error( { error: error, message: req.query, function: 'taskInfo' } );
|
|
426
427
|
return res.sendError( { error: error }, 500 );
|
|
427
428
|
}
|
|
@@ -433,7 +434,7 @@ export const taskTable = async ( req, res ) => {
|
|
|
433
434
|
let resultData = await taskTableData( requestData );
|
|
434
435
|
return res.sendSuccess( resultData );
|
|
435
436
|
} catch ( error ) {
|
|
436
|
-
|
|
437
|
+
console.log( 'error =>', error );
|
|
437
438
|
logger.error( { error: error, function: 'taskTable' } );
|
|
438
439
|
return res.sendError( error, 500 );
|
|
439
440
|
}
|
|
@@ -527,7 +528,7 @@ async function taskTableData( requestData ) {
|
|
|
527
528
|
};
|
|
528
529
|
return tableData;
|
|
529
530
|
} catch ( error ) {
|
|
530
|
-
|
|
531
|
+
console.log( 'error =>', error );
|
|
531
532
|
logger.error( { error: error, message: requestData, function: 'taskTableData' } );
|
|
532
533
|
return res.sendError( error, 500 );
|
|
533
534
|
}
|
|
@@ -539,7 +540,7 @@ export const taskInfoTable = async ( req, res ) => {
|
|
|
539
540
|
let resultData = await taskInfoTableData( requestData );
|
|
540
541
|
return res.sendSuccess( resultData );
|
|
541
542
|
} catch ( error ) {
|
|
542
|
-
|
|
543
|
+
console.log( 'error =>', error );
|
|
543
544
|
logger.error( { error: error, function: 'taskInfoTable' } );
|
|
544
545
|
return res.sendError( error, 500 );
|
|
545
546
|
}
|
|
@@ -673,7 +674,7 @@ async function taskInfoTableData( requestData ) {
|
|
|
673
674
|
};
|
|
674
675
|
return tableInfoData;
|
|
675
676
|
} catch ( error ) {
|
|
676
|
-
|
|
677
|
+
console.log( 'error =>', error );
|
|
677
678
|
logger.error( { error: error, message: requestData, function: 'tableInfoData' } );
|
|
678
679
|
return res.sendError( error, 500 );
|
|
679
680
|
}
|
|
@@ -684,7 +685,7 @@ export const taskDropdownList = async ( req, res ) => {
|
|
|
684
685
|
let resultData = await taskDropdownListData( requestData );
|
|
685
686
|
return res.sendSuccess( resultData );
|
|
686
687
|
} catch ( error ) {
|
|
687
|
-
|
|
688
|
+
console.log( 'error =>', error );
|
|
688
689
|
logger.error( { error: error, function: 'taskDropdownList' } );
|
|
689
690
|
return res.sendError( error, 500 );
|
|
690
691
|
}
|
|
@@ -737,7 +738,7 @@ async function taskDropdownListData( requestData ) {
|
|
|
737
738
|
};
|
|
738
739
|
return taskDropdownListData;
|
|
739
740
|
} catch ( error ) {
|
|
740
|
-
|
|
741
|
+
console.log( 'error =>', error );
|
|
741
742
|
logger.error( { error: error, message: requestData, function: 'taskDropdownListData' } );
|
|
742
743
|
return res.sendError( error, 500 );
|
|
743
744
|
}
|
|
@@ -798,7 +799,7 @@ export const taskDropdownListV1 = async ( req, res ) => {
|
|
|
798
799
|
result.taskDropdown = getChecklistData;
|
|
799
800
|
return res.sendSuccess( result );
|
|
800
801
|
} catch ( error ) {
|
|
801
|
-
|
|
802
|
+
console.log( 'error =>', error );
|
|
802
803
|
logger.error( { error: error, message: req.query, function: 'checklistDropdown' } );
|
|
803
804
|
return res.sendError( { error: error }, 500 );
|
|
804
805
|
}
|
|
@@ -906,7 +907,7 @@ export const taskDropdownListNew = async ( req, res ) => {
|
|
|
906
907
|
result.taskDropdown = getChecklistData;
|
|
907
908
|
return res.sendSuccess( result );
|
|
908
909
|
} catch ( error ) {
|
|
909
|
-
|
|
910
|
+
console.log( 'error =>', error );
|
|
910
911
|
logger.error( { error: error, message: req.query, function: 'checklistDropdownV1' } );
|
|
911
912
|
return res.sendError( { error: error }, 500 );
|
|
912
913
|
}
|
|
@@ -917,7 +918,7 @@ export const taskInfoView = async ( req, res ) => {
|
|
|
917
918
|
let resultData = await taskInfoViewData( requestData );
|
|
918
919
|
return res.sendSuccess( resultData );
|
|
919
920
|
} catch ( error ) {
|
|
920
|
-
|
|
921
|
+
console.log( 'error =>', error );
|
|
921
922
|
logger.error( { error: error, function: 'taskInfoView' } );
|
|
922
923
|
return res.sendError( error, 500 );
|
|
923
924
|
}
|
|
@@ -948,7 +949,7 @@ async function taskInfoViewData( requestData ) {
|
|
|
948
949
|
};
|
|
949
950
|
return taskInfoViewData;
|
|
950
951
|
} catch ( error ) {
|
|
951
|
-
|
|
952
|
+
console.log( 'error =>', error );
|
|
952
953
|
logger.error( { error: error, message: requestData, function: 'taskInfoViewData' } );
|
|
953
954
|
return res.sendError( error, 500 );
|
|
954
955
|
}
|
|
@@ -963,7 +964,7 @@ export const taskDeleteV1 = async ( req, res ) => {
|
|
|
963
964
|
|
|
964
965
|
const taskConfig = await taskService.findOne( { _id: new mongoose.Types.ObjectId( requestData.taskId ) }, { _id: 1 } );
|
|
965
966
|
if ( !taskConfig ) {
|
|
966
|
-
|
|
967
|
+
console.log( 'Task found:', taskConfig );
|
|
967
968
|
return res.sendError( 'Task not found', 404 );
|
|
968
969
|
}
|
|
969
970
|
|
|
@@ -973,7 +974,7 @@ export const taskDeleteV1 = async ( req, res ) => {
|
|
|
973
974
|
);
|
|
974
975
|
|
|
975
976
|
if ( resultData ) {
|
|
976
|
-
|
|
977
|
+
console.log( 'Update result:', resultData );
|
|
977
978
|
return res.sendSuccess( { message: 'Task deleted successfully' } );
|
|
978
979
|
} else {
|
|
979
980
|
return res.sendError( 'Something went wrong please try again', 500 );
|
package/src/dtos/task.dto.js
CHANGED
|
@@ -44,13 +44,16 @@ export const commonAiTaskSchema = Joi.object().keys( {
|
|
|
44
44
|
scheduleEndTime: Joi.string().optional(),
|
|
45
45
|
referenceImage: Joi.array().required(),
|
|
46
46
|
} );
|
|
47
|
+
const questionSchema = Joi.object( {
|
|
48
|
+
question: Joi.string().required(),
|
|
49
|
+
answerType: Joi.string().required(),
|
|
50
|
+
options: Joi.array().items().optional(),
|
|
51
|
+
} );
|
|
47
52
|
export const taskcreationSchema = Joi.object().keys( {
|
|
48
53
|
storeName: Joi.string().required(),
|
|
49
54
|
taskName: Joi.string().required(),
|
|
50
55
|
user: Joi.string().required(),
|
|
51
|
-
|
|
52
|
-
answerType: Joi.string().required(),
|
|
53
|
-
options: Joi.array().optional(),
|
|
56
|
+
questions: Joi.array().items( questionSchema ).required(),
|
|
54
57
|
scheduleDate: Joi.string().optional(),
|
|
55
58
|
scheduleEndTime: Joi.string().optional(),
|
|
56
59
|
approver: Joi.string().required(),
|