tango-app-api-task 3.3.1-hotfix-1 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-task",
3
- "version": "3.3.1-hotfix-1",
3
+ "version": "3.3.1-hotfix-2",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -4056,7 +4056,7 @@ export async function taskcreation( req, res ) {
4056
4056
  }
4057
4057
  if ( response?._id ) {
4058
4058
  let question = [];
4059
- for ( let ques of inputBody.questions ) {
4059
+ for ( let [ index, ques ] of inputBody.questions.entries() ) {
4060
4060
  let answer = await findAnswer( ques?.answerType );
4061
4061
  if ( answer.length == 0 ) {
4062
4062
  return res.sendError( 'please enter Valid AnswerType', 500 );
@@ -4078,7 +4078,7 @@ export async function taskcreation( req, res ) {
4078
4078
  'linkedQuestion': 0,
4079
4079
  'nestedQuestion': [],
4080
4080
  };
4081
- optiondata.answer = option;
4081
+ optiondata.answer = String( option );
4082
4082
  optionsResult.push( optiondata );
4083
4083
  }
4084
4084
  answer = optionsResult;
@@ -4087,7 +4087,7 @@ export async function taskcreation( req, res ) {
4087
4087
  }
4088
4088
  }
4089
4089
  question.push( {
4090
- 'qno': 1,
4090
+ 'qno': index+1,
4091
4091
  'qname': ques.question,
4092
4092
  'answerType': ques?.answerType || 'yes/no',
4093
4093
  'runAI': false,
@@ -4130,7 +4130,6 @@ export async function taskcreation( req, res ) {
4130
4130
  // answer[0].referenceImage = question[0].questionReferenceImage;
4131
4131
  // }
4132
4132
 
4133
-
4134
4133
  question = {
4135
4134
  checkListId: response?._id,
4136
4135
  question: question,
@@ -44,12 +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
- questions: Joi.array().required(),
52
- options: Joi.array().optional(),
56
+ questions: Joi.array().items( questionSchema ).required(),
53
57
  scheduleDate: Joi.string().optional(),
54
58
  scheduleEndTime: Joi.string().optional(),
55
59
  approver: Joi.string().required(),