tango-app-api-trax 1.0.0-task.125 → 1.0.0-task.126
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-trax",
|
|
3
|
-
"version": "1.0.0-task.
|
|
3
|
+
"version": "1.0.0-task.126",
|
|
4
4
|
"description": "Trax",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"mongodb": "^6.8.0",
|
|
27
27
|
"nodemon": "^3.1.4",
|
|
28
28
|
"path": "^0.12.7",
|
|
29
|
-
"tango-api-schema": "^2.1.
|
|
29
|
+
"tango-api-schema": "^2.1.94",
|
|
30
30
|
"tango-app-api-middleware": "^3.1.43-alpha.10",
|
|
31
31
|
"url": "^0.11.4",
|
|
32
32
|
"winston": "^3.13.1",
|
|
@@ -108,136 +108,138 @@ export async function startChecklist( req, res ) {
|
|
|
108
108
|
|
|
109
109
|
if ( getBeforeChecklist[0].checklistStatus != 'open' ) {
|
|
110
110
|
return res.sendError( 'already check list started', 400 );
|
|
111
|
-
}
|
|
112
|
-
logger.info( `v5 => Checklist Started => store Name: ${getBeforeChecklist[0].storeName}, User Email: ${getBeforeChecklist[0].userEmail}, Checklist Name: ${getBeforeChecklist[0].checkListName}` );
|
|
113
|
-
let PCLQusestion = await PCLconfig.findOne( { _id: new ObjectId( getBeforeChecklist[0].checkListId ) } );
|
|
114
|
-
let updateQuery = {};
|
|
115
|
-
updateQuery._id = new ObjectId( requestData.processedcheckListId );
|
|
116
|
-
updateQuery.userId = req.user._id;
|
|
117
|
-
updateQuery.date_string = requestData.date;
|
|
111
|
+
}
|
|
118
112
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
} );
|
|
138
|
-
question.Multianswer = Multianswer;
|
|
139
|
-
}
|
|
140
|
-
} else {
|
|
141
|
-
question.Multianswer = [];
|
|
113
|
+
logger.info( `v5 => Checklist Started => store Name: ${getBeforeChecklist[0].storeName}, User Email: ${getBeforeChecklist[0].userEmail}, Checklist Name: ${getBeforeChecklist[0].checkListName}` );
|
|
114
|
+
let PCLQusestion = await PCLconfig.findOne( { _id: new ObjectId( getBeforeChecklist[0].checkListId ) } );
|
|
115
|
+
let updateQuery = {};
|
|
116
|
+
updateQuery._id = new ObjectId( requestData.processedcheckListId );
|
|
117
|
+
updateQuery.userId = req.user._id;
|
|
118
|
+
updateQuery.date_string = requestData.date;
|
|
119
|
+
|
|
120
|
+
if ( PCLQusestion && PCLQusestion?.questionAnswers && PCLQusestion?.questionAnswers.length > 0 ) {
|
|
121
|
+
await PCLQusestion.questionAnswers.forEach( ( section ) => {
|
|
122
|
+
section.questions.forEach( ( question ) => {
|
|
123
|
+
if ( question.answerType == 'multiplechoicemultiple' ) {
|
|
124
|
+
let Multianswer = [];
|
|
125
|
+
if ( question.answers.length > 0 ) {
|
|
126
|
+
question.answers.forEach( ( answer, ansIndex ) => {
|
|
127
|
+
Multianswer.push( { 'answer': null, 'no': ansIndex, 'validationAnswer': null } );
|
|
128
|
+
answer.index = ansIndex;
|
|
129
|
+
} );
|
|
130
|
+
question.Multianswer = Multianswer;
|
|
142
131
|
}
|
|
143
|
-
} )
|
|
132
|
+
} else if ( question.answerType == 'multipleImage' ) {
|
|
133
|
+
let Multianswer = [];
|
|
134
|
+
if ( question.answers.length > 0 ) {
|
|
135
|
+
question.answers.forEach( ( answer, ansIndex ) => {
|
|
136
|
+
Multianswer.push( { 'answer': null, 'no': ansIndex, 'validationAnswer': null } );
|
|
137
|
+
answer.index = ansIndex;
|
|
138
|
+
} );
|
|
139
|
+
question.Multianswer = Multianswer;
|
|
140
|
+
}
|
|
141
|
+
} else {
|
|
142
|
+
question.Multianswer = [];
|
|
143
|
+
}
|
|
144
144
|
} );
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
let updateData = {};
|
|
148
|
-
let storeTimeZone = await storeService.findOne( { storeName: getBeforeChecklist[0].storeName }, { 'storeProfile.timeZone': 1 } );
|
|
149
|
-
let currentDateTime;
|
|
150
|
-
if ( storeTimeZone?.storeProfile?.timeZone ) {
|
|
151
|
-
currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
|
|
152
|
-
} else {
|
|
153
|
-
currentDateTime = dayjs();
|
|
154
|
-
}
|
|
155
|
-
updateData.checklistStatus = 'inprogress';
|
|
156
|
-
updateData.startMobileTime = requestData?.currentTime;
|
|
157
|
-
updateData.questionAnswers = getBeforeChecklist.redoStatus ? getBeforeChecklist.questionAnswers : PCLQusestion.questionAnswers;
|
|
158
|
-
// const newDateTime = currentDateTime.add(5, 'hours').add(30, 'minutes');
|
|
159
|
-
// updateData.startTime_string = newDateTime.format('hh:mm A, DD MMM');
|
|
160
|
-
updateData.startTime_string = currentDateTime.format( 'hh:mm A, DD MMM YYYY' );
|
|
161
|
-
updateData.startTime = dayjs.utc( updateData.startTime_string, 'hh:mm A, DD MMM YYYY' ).format();
|
|
145
|
+
} );
|
|
146
|
+
}
|
|
162
147
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
148
|
+
let updateData = {};
|
|
149
|
+
let storeTimeZone = await storeService.findOne( { storeName: getBeforeChecklist[0].storeName }, { 'storeProfile.timeZone': 1 } );
|
|
150
|
+
let currentDateTime;
|
|
151
|
+
if ( storeTimeZone?.storeProfile?.timeZone ) {
|
|
152
|
+
currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
|
|
153
|
+
} else {
|
|
154
|
+
currentDateTime = dayjs();
|
|
155
|
+
}
|
|
156
|
+
updateData.checklistStatus = 'inprogress';
|
|
157
|
+
updateData.startMobileTime = requestData?.currentTime;
|
|
158
|
+
updateData.questionAnswers = getBeforeChecklist[0]?.redoStatus ? getBeforeChecklist[0].questionAnswers : PCLQusestion.questionAnswers;
|
|
159
|
+
// const newDateTime = currentDateTime.add(5, 'hours').add(30, 'minutes');
|
|
160
|
+
// updateData.startTime_string = newDateTime.format('hh:mm A, DD MMM');
|
|
161
|
+
updateData.startTime_string = currentDateTime.format( 'hh:mm A, DD MMM YYYY' );
|
|
162
|
+
updateData.startTime = dayjs.utc( updateData.startTime_string, 'hh:mm A, DD MMM YYYY' ).format();
|
|
163
|
+
|
|
164
|
+
let updatechecklist = await processedchecklist.updateOne( updateQuery, updateData );
|
|
165
|
+
PCLQusestion.startTime = dayjs.utc( updateData.startTime_string, 'hh:mm A, DD MMM YYYY' ).format();
|
|
166
|
+
PCLQusestion.save();
|
|
167
|
+
if ( updatechecklist.modifiedCount > 0 ) {
|
|
168
|
+
findQuery.push( {
|
|
169
|
+
$project: {
|
|
170
|
+
checkListName: { $ifNull: [ '$checkListName', '' ] },
|
|
171
|
+
scheduleStartTime: { $ifNull: [ '$scheduleStartTime', '' ] },
|
|
172
|
+
scheduleStartTime_iso: { $ifNull: [ '$scheduleStartTime_iso', '' ] },
|
|
173
|
+
scheduleEndTime: { $ifNull: [ '$scheduleEndTime', '' ] },
|
|
174
|
+
scheduleEndTime_iso: { $ifNull: [ '$scheduleEndTime_iso', '' ] },
|
|
175
|
+
checklistStatus: { $ifNull: [ '$checklistStatus', '' ] },
|
|
176
|
+
checkListId: { $ifNull: [ '$checkListId', '' ] },
|
|
177
|
+
startTime: { $ifNull: [ '$startTime', '' ] },
|
|
178
|
+
submitTime: { $ifNull: [ '$submitTime', '' ] },
|
|
179
|
+
allowedOverTime: { $ifNull: [ '$allowedOverTime', '' ] },
|
|
180
|
+
allowedStoreLocation: { $ifNull: [ '$checallowedStoreLocationkListName', false ] },
|
|
181
|
+
questionAnswers: { $ifNull: [ '$questionAnswers', '' ] },
|
|
182
|
+
redoStatus: { $ifNull: [ '$redoStatus', '' ] },
|
|
183
|
+
},
|
|
184
|
+
} );
|
|
185
|
+
let getupdatedchecklist = await processedchecklist.aggregate( findQuery );
|
|
186
|
+
let bucket = JSON.parse( process.env.BUCKET );
|
|
187
|
+
getupdatedchecklist[0].questionAnswers.forEach( ( section ) => {
|
|
188
|
+
section.questions.forEach( async ( question ) => {
|
|
189
|
+
if ( question.questionReferenceImage && question.questionReferenceImage!='' ) {
|
|
190
|
+
question.questionReferenceImage = await signedUrl( { Bucket: bucket.sop, file_path: decodeURIComponent( question.questionReferenceImage ) } );
|
|
191
|
+
}
|
|
192
|
+
question.answers.forEach( async ( answer ) => {
|
|
193
|
+
if ( answer.referenceImage != '' ) {
|
|
194
|
+
answer.referenceImage = await signedUrl( { Bucket: bucket.sop, file_path: decodeURIComponent( answer.referenceImage ) } );
|
|
189
195
|
}
|
|
190
|
-
question.answers.forEach( async ( answer ) => {
|
|
191
|
-
if ( answer.referenceImage != '' ) {
|
|
192
|
-
answer.referenceImage = await signedUrl( { Bucket: bucket.sop, file_path: decodeURIComponent( answer.referenceImage ) } );
|
|
193
|
-
}
|
|
194
|
-
} );
|
|
195
196
|
} );
|
|
196
197
|
} );
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
198
|
+
} );
|
|
199
|
+
let logInsertData = {
|
|
200
|
+
store_id: getBeforeChecklist[0].store_id,
|
|
201
|
+
storeName: getBeforeChecklist[0].storeName,
|
|
202
|
+
action: 'started',
|
|
203
|
+
checklistId: getBeforeChecklist[0].checkListId,
|
|
204
|
+
checkListName: getBeforeChecklist[0].checkListName,
|
|
205
|
+
checkListType: getBeforeChecklist[0].checkListType,
|
|
206
|
+
client_id: req.user.clientId,
|
|
207
|
+
};
|
|
208
|
+
await checklistLogs.create( logInsertData );
|
|
206
209
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
210
|
+
let getchecklist = getupdatedchecklist;
|
|
211
|
+
let questions = [];
|
|
212
|
+
function processQuestion( question, section, questions, nested=false ) {
|
|
213
|
+
let findExists = questions.find( ( item ) => item?.qno && item.qno == question.qno );
|
|
214
|
+
if ( findExists && nested ) {
|
|
215
|
+
let findIndex = questions.findIndex( ( item ) => item?.qno && item.qno == question.qno );
|
|
216
|
+
questions.splice( findIndex, 1 );
|
|
217
|
+
questions.push( question );
|
|
218
|
+
}
|
|
219
|
+
if ( !findExists ) {
|
|
220
|
+
questions.push( question );
|
|
221
|
+
for ( let answer of question.answers ) {
|
|
222
|
+
if ( answer.showLinked && answer?.linkedQuestion != '' ) {
|
|
223
|
+
let linkedQuestion = section.questions.find( ( item ) => item.qno == answer.linkedQuestion );
|
|
224
|
+
if ( linkedQuestion ) {
|
|
225
|
+
processQuestion( linkedQuestion, section, questions, true );
|
|
224
226
|
}
|
|
225
227
|
}
|
|
226
228
|
}
|
|
227
229
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
getchecklist[index].questionAnswers[secIndex].questions = questions;
|
|
230
|
+
}
|
|
231
|
+
for ( let [ index, data ] of getchecklist.entries() ) {
|
|
232
|
+
for ( let [ secIndex, section ] of data.questionAnswers.entries() ) {
|
|
233
|
+
questions = [];
|
|
234
|
+
for ( let question of section.questions ) {
|
|
235
|
+
processQuestion( question, section, questions );
|
|
235
236
|
}
|
|
237
|
+
getchecklist[index].questionAnswers[secIndex].questions = questions;
|
|
236
238
|
}
|
|
237
|
-
return res.sendSuccess( getchecklist );
|
|
238
|
-
} else {
|
|
239
|
-
return res.sendError( 'something went wrong please try again', 500 );
|
|
240
239
|
}
|
|
240
|
+
return res.sendSuccess( getchecklist );
|
|
241
|
+
} else {
|
|
242
|
+
return res.sendError( 'something went wrong please try again', 500 );
|
|
241
243
|
}
|
|
242
244
|
} catch ( e ) {
|
|
243
245
|
logger.error( { function: 'startChecklist', error: e } );
|
|
@@ -340,6 +342,7 @@ export async function startTask( req, res ) {
|
|
|
340
342
|
allowedOverTime: { $ifNull: [ '$allowedOverTime', '' ] },
|
|
341
343
|
allowedStoreLocation: { $ifNull: [ '$allowedStoreLocation', false ] },
|
|
342
344
|
questionAnswers: { $ifNull: [ '$questionAnswers', '' ] },
|
|
345
|
+
redoStatus: { $ifNull: [ '$redoStatus', '' ] },
|
|
343
346
|
},
|
|
344
347
|
} );
|
|
345
348
|
const getUpdatedTask = await processedTask.aggregate( findQuery );
|
|
@@ -376,6 +379,7 @@ export async function startTask( req, res ) {
|
|
|
376
379
|
action: 'started',
|
|
377
380
|
checklistId: task.checkListId,
|
|
378
381
|
checkListName: task.checkListName,
|
|
382
|
+
checkListType: task.checkListType,
|
|
379
383
|
client_id: user.clientId,
|
|
380
384
|
};
|
|
381
385
|
await checklistLogs.create( logData );
|
|
@@ -574,12 +578,14 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
|
|
|
574
578
|
structure.remarks = requestSection[i].remarks;
|
|
575
579
|
structure.answers = qaAnswers[j].answers;
|
|
576
580
|
structure.userAnswer = yn;
|
|
577
|
-
structure.linkType = qaAnswers[j].linkType
|
|
578
|
-
structure.linkquestionenabled = requestSection[i].linkquestionenabled
|
|
579
|
-
structure.parentanswer = requestSection[i].parentanswer
|
|
580
|
-
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage
|
|
581
|
-
structure.descriptivetype = qaAnswers[j].descriptivetype
|
|
582
|
-
|
|
581
|
+
structure.linkType = qaAnswers[j].linkType;
|
|
582
|
+
structure.linkquestionenabled = requestSection[i].linkquestionenabled;
|
|
583
|
+
structure.parentanswer = requestSection[i].parentanswer;
|
|
584
|
+
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
585
|
+
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
586
|
+
if ( qaAnswers[j]?.redo ) {
|
|
587
|
+
structure.redo = false;
|
|
588
|
+
}
|
|
583
589
|
newArray.push( structure );
|
|
584
590
|
} else if ( qaAnswers[j].answerType == 'multiplechoicesingle' ) {
|
|
585
591
|
let qaans = qaAnswers[j].answers;
|
|
@@ -614,12 +620,14 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
|
|
|
614
620
|
structure.remarks = requestSection[i].remarks;
|
|
615
621
|
structure.answers = qaAnswers[j].answers;
|
|
616
622
|
structure.userAnswer = ms;
|
|
617
|
-
structure.linkType = qaAnswers[j].linkType
|
|
618
|
-
structure.linkquestionenabled = requestSection[i].linkquestionenabled
|
|
619
|
-
structure.parentanswer = requestSection[i].parentanswer
|
|
620
|
-
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage
|
|
621
|
-
structure.descriptivetype = qaAnswers[j].descriptivetype
|
|
622
|
-
|
|
623
|
+
structure.linkType = qaAnswers[j].linkType;
|
|
624
|
+
structure.linkquestionenabled = requestSection[i].linkquestionenabled;
|
|
625
|
+
structure.parentanswer = requestSection[i].parentanswer;
|
|
626
|
+
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
627
|
+
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
628
|
+
if ( qaAnswers[j]?.redo ) {
|
|
629
|
+
structure.redo = false;
|
|
630
|
+
}
|
|
623
631
|
newArray.push( structure );
|
|
624
632
|
} else if ( qaAnswers[j].answerType == 'multiplechoicemultiple' ) {
|
|
625
633
|
let qaans = qaAnswers[j].answers;
|
|
@@ -658,12 +666,14 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
|
|
|
658
666
|
structure.remarks = requestSection[i].remarks;
|
|
659
667
|
structure.answers = qaAnswers[j].answers;
|
|
660
668
|
structure.userAnswer = mcmo;
|
|
661
|
-
structure.linkType = qaAnswers[j].linkType
|
|
662
|
-
structure.linkquestionenabled = requestSection[i].linkquestionenabled
|
|
663
|
-
structure.parentanswer = requestSection[i].parentanswer
|
|
664
|
-
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage
|
|
665
|
-
structure.descriptivetype = qaAnswers[j].descriptivetype
|
|
666
|
-
|
|
669
|
+
structure.linkType = qaAnswers[j].linkType;
|
|
670
|
+
structure.linkquestionenabled = requestSection[i].linkquestionenabled;
|
|
671
|
+
structure.parentanswer = requestSection[i].parentanswer;
|
|
672
|
+
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
673
|
+
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
674
|
+
if ( qaAnswers[j]?.redo ) {
|
|
675
|
+
structure.redo = false;
|
|
676
|
+
}
|
|
667
677
|
newArray.push( structure );
|
|
668
678
|
} else if ( qaAnswers[j].answerType == 'multipleImage' ) {
|
|
669
679
|
let separatedArray = typeof requestSection[i].Multianswer == 'string' ? JSON.parse( requestSection[i].Multianswer ) : requestSection[i].Multianswer;
|
|
@@ -707,12 +717,14 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
|
|
|
707
717
|
structure.remarks = requestSection[i].remarks;
|
|
708
718
|
structure.answers = qaAnswers[j].answers;
|
|
709
719
|
structure.userAnswer = mcmi;
|
|
710
|
-
structure.linkType = qaAnswers[j].linkType
|
|
711
|
-
structure.linkquestionenabled = requestSection[i].linkquestionenabled
|
|
712
|
-
structure.parentanswer = requestSection[i].parentanswer
|
|
713
|
-
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage
|
|
714
|
-
structure.descriptivetype = qaAnswers[j].descriptivetype
|
|
715
|
-
|
|
720
|
+
structure.linkType = qaAnswers[j].linkType;
|
|
721
|
+
structure.linkquestionenabled = requestSection[i].linkquestionenabled;
|
|
722
|
+
structure.parentanswer = requestSection[i].parentanswer;
|
|
723
|
+
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
724
|
+
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
725
|
+
if ( qaAnswers[j]?.redo ) {
|
|
726
|
+
structure.redo = false;
|
|
727
|
+
}
|
|
716
728
|
newArray.push( structure );
|
|
717
729
|
} else {
|
|
718
730
|
let des = [];
|
|
@@ -751,12 +763,14 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
|
|
|
751
763
|
structure.remarks = requestSection[i].remarks;
|
|
752
764
|
structure.answers = qaAnswers[j].answers;
|
|
753
765
|
structure.userAnswer = des;
|
|
754
|
-
structure.linkType = qaAnswers[j].linkType
|
|
755
|
-
structure.linkquestionenabled = requestSection[i].linkquestionenabled
|
|
756
|
-
structure.parentanswer = requestSection[i].parentanswer
|
|
757
|
-
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage
|
|
758
|
-
structure.descriptivetype = qaAnswers[j].descriptivetype
|
|
759
|
-
|
|
766
|
+
structure.linkType = qaAnswers[j].linkType;
|
|
767
|
+
structure.linkquestionenabled = requestSection[i].linkquestionenabled;
|
|
768
|
+
structure.parentanswer = requestSection[i].parentanswer;
|
|
769
|
+
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
770
|
+
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
771
|
+
if ( qaAnswers[j]?.redo ) {
|
|
772
|
+
structure.redo = false;
|
|
773
|
+
}
|
|
760
774
|
newArray.push( structure );
|
|
761
775
|
}
|
|
762
776
|
}
|
|
@@ -1162,6 +1176,7 @@ export async function submitChecklist( req, res ) {
|
|
|
1162
1176
|
checklistId: getchecklist[0].sourceCheckList_id,
|
|
1163
1177
|
processedChecklistId: getchecklist[0]._id,
|
|
1164
1178
|
checkListName: getchecklist[0].checkListName,
|
|
1179
|
+
checkListType: getchecklist[0].checkListType,
|
|
1165
1180
|
client_id: req.user.clientId,
|
|
1166
1181
|
};
|
|
1167
1182
|
|
|
@@ -1295,6 +1310,7 @@ export async function submitTask( req, res ) {
|
|
|
1295
1310
|
action: submittype === 'draft' ? 'saved' : 'submitted',
|
|
1296
1311
|
checklistId: checklist.sourceCheckList_id,
|
|
1297
1312
|
processedChecklistId: checklist._id,
|
|
1313
|
+
checkListType: checklist.checkListType,
|
|
1298
1314
|
checkListName,
|
|
1299
1315
|
client_id: user.clientId,
|
|
1300
1316
|
};
|
|
@@ -1332,6 +1348,7 @@ async function updateOpenSearch( user, data ) {
|
|
|
1332
1348
|
action: 'OpenSearch insert Triggered',
|
|
1333
1349
|
checklistId: getchecklist[0].checkListId,
|
|
1334
1350
|
checkListName: getchecklist[0].checkListName,
|
|
1351
|
+
checkListType: getchecklist[0].checkListType,
|
|
1335
1352
|
client_id: user.clientId,
|
|
1336
1353
|
};
|
|
1337
1354
|
await checklistLogs.create( logInsertData );
|
|
@@ -1351,6 +1368,7 @@ async function updateOpenSearch( user, data ) {
|
|
|
1351
1368
|
action: 'OpenSearch inserted Successfully',
|
|
1352
1369
|
checklistId: getchecklist[0].checkListId,
|
|
1353
1370
|
checkListName: getchecklist[0].checkListName,
|
|
1371
|
+
checkListType: getchecklist[0].checkListType,
|
|
1354
1372
|
client_id: user.clientId,
|
|
1355
1373
|
};
|
|
1356
1374
|
await checklistLogs.create( logInsertData );
|
|
@@ -1377,6 +1395,7 @@ async function updateOpenSearchTask( user, data ) {
|
|
|
1377
1395
|
action: 'OpenSearch insert Triggered',
|
|
1378
1396
|
checklistId: getchecklist[0].checkListId,
|
|
1379
1397
|
checkListName: getchecklist[0].checkListName,
|
|
1398
|
+
checkListType: getchecklist[0].checkListType,
|
|
1380
1399
|
client_id: user.clientId,
|
|
1381
1400
|
};
|
|
1382
1401
|
await checklistLogs.create( logInsertData );
|
|
@@ -1396,6 +1415,7 @@ async function updateOpenSearchTask( user, data ) {
|
|
|
1396
1415
|
action: 'OpenSearch inserted Successfully',
|
|
1397
1416
|
checklistId: getchecklist[0].checkListId,
|
|
1398
1417
|
checkListName: getchecklist[0].checkListName,
|
|
1418
|
+
checkListType: getchecklist[0].checkListType,
|
|
1399
1419
|
client_id: user.clientId,
|
|
1400
1420
|
};
|
|
1401
1421
|
await checklistLogs.create( logInsertData );
|
|
@@ -1770,6 +1790,7 @@ export async function questionList( req, res ) {
|
|
|
1770
1790
|
getchecklist: { $ifNull: [ '$getchecklist', '' ] },
|
|
1771
1791
|
userEmail: { $ifNull: [ '$userEmail', '' ] },
|
|
1772
1792
|
storeName: { $ifNull: [ '$storeName', '' ] },
|
|
1793
|
+
redoStatus: { $ifNull: [ '$redoStatus', false ] },
|
|
1773
1794
|
},
|
|
1774
1795
|
} );
|
|
1775
1796
|
|