tango-app-api-trax 3.4.0-flag-10 → 3.4.0-soplink2-0

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.
@@ -1,4 +1,4 @@
1
- import { signedUrl, fileUpload, chunkArray, logger, sendPushNotification, insertOpenSearchData } from 'tango-app-api-middleware';
1
+ import { fileUpload, chunkArray, logger, sendPushNotification, insertOpenSearchData } from 'tango-app-api-middleware';
2
2
  import * as checklistService from '../services/checklist.service.js';
3
3
  import * as questionService from '../services/checklistQuestion.service.js';
4
4
  import * as assignedService from '../services/checklistAssign.service.js';
@@ -24,6 +24,7 @@ dayjs.extend( customParseFormat );
24
24
  import * as clusterServices from '../services/cluster.service.js';
25
25
  import * as teamsServices from '../services/teams.service.js';
26
26
 
27
+
27
28
  export const checklist = async ( req, res ) => {
28
29
  try {
29
30
  let limit = parseInt( req.query.limit ) || 10;
@@ -246,14 +247,15 @@ export const create = async ( req, res ) => {
246
247
  section.questions[qIdx].answers[index].nestedQuestion = [];
247
248
  }
248
249
  if ( answer.showLinked ) {
250
+ // section.questions[qIdx].answers[nestedIndex].nestedQuestion.push( answer.linkedQuestion );
249
251
  if ( nestedIndex != -1 ) {
250
- if ( !section.questions[qIdx].answers[nestedIndex].nestedQuestion.includes( answer.linkedQuestion ) ) {
251
- section.questions[qIdx].answers[nestedIndex].nestedQuestion.push( answer.linkedQuestion );
252
- }
252
+ // if ( !section.questions[qIdx].answers[nestedIndex].nestedQuestion.includes( answer.linkedQuestion ) ) {
253
+ section.questions[qIdx].answers[nestedIndex].nestedQuestion.push( answer.linkedQuestion );
254
+ // }
253
255
  } else {
254
- if ( !section.questions[qIdx].answers[index].nestedQuestion.includes( answer.linkedQuestion ) ) {
255
- section.questions[qIdx].answers[index].nestedQuestion.push( answer.linkedQuestion );
256
- }
256
+ // if ( !section.questions[qIdx].answers[index].nestedQuestion.includes( answer.linkedQuestion ) ) {
257
+ section.questions[qIdx].answers[index].nestedQuestion.push( answer.linkedQuestion );
258
+ // }
257
259
  }
258
260
  let nestedLinkedQuestion = section.questions.find( ( item ) => item.qno == answer.linkedQuestion );
259
261
  if ( nestedLinkedQuestion ) {
@@ -270,6 +272,18 @@ export const create = async ( req, res ) => {
270
272
  }
271
273
  }
272
274
  }
275
+ let checkNestedLevel = false;
276
+ section.questions.forEach( ( qns ) => {
277
+ qns.answers.forEach( ( answ ) => {
278
+ if ( answ.nestedQuestion.length > 20 ) {
279
+ checkNestedLevel = true;
280
+ }
281
+ } );
282
+ } );
283
+
284
+ if ( checkNestedLevel ) {
285
+ return res.sendError( { message: 'Unable to create more than 20 linked questions.' }, 400 );
286
+ }
273
287
 
274
288
  let sectionList = {
275
289
  section: section.name,
@@ -301,6 +315,7 @@ export const create = async ( req, res ) => {
301
315
  return res.sendSuccess( { checklistId: checkListId, msg: 'CheckList Created Successfully' } );
302
316
  }
303
317
  } ).catch( ( e ) => {
318
+ console.log( e );
304
319
  return res.sendError( e, 500 );
305
320
  } );
306
321
  }
@@ -310,6 +325,7 @@ export const create = async ( req, res ) => {
310
325
  }
311
326
  }
312
327
  } ).catch( async ( e ) => {
328
+ console.log( e );
313
329
  await checklistService.deleteOne( { _id: checkListId } );
314
330
  return res.sendError( e, 500 );
315
331
  } );
@@ -373,23 +389,23 @@ export const getConfigDetails = async ( req, res ) => {
373
389
  let questionDetails = await questionService.find( query );
374
390
  if ( questionDetails.length ) {
375
391
  let sections = [];
376
- let bucket = JSON.parse( process.env.BUCKET );
392
+ // let bucket = JSON.parse( process.env.BUCKET );
377
393
  questionDetails.forEach( ( item ) => {
378
394
  item.question.forEach( async ( question ) => {
379
395
  if ( question.questionReferenceImage && question.questionReferenceImage !='' ) {
380
- let inputData = {
381
- Bucket: bucket.sop,
382
- file_path: decodeURIComponent( question.questionReferenceImage ),
383
- };
384
- question.questionReferenceImage = await signedUrl( inputData );
396
+ // let inputData = {
397
+ // Bucket: bucket.sop,
398
+ // file_path: decodeURIComponent( question.questionReferenceImage ),
399
+ // };
400
+ question.questionReferenceImage = JSON.parse( process.env.CDNURL )?.TraxAnswerCDN+question.questionReferenceImage;
385
401
  }
386
402
  question.answers.forEach( async ( answer ) => {
387
403
  if ( answer.referenceImage != '' ) {
388
- let inputData = {
389
- Bucket: bucket.sop,
390
- file_path: decodeURIComponent( answer.referenceImage ),
391
- };
392
- answer.referenceImage = await signedUrl( inputData );
404
+ // let inputData = {
405
+ // Bucket: bucket.sop,
406
+ // file_path: decodeURIComponent( answer.referenceImage ),
407
+ // };
408
+ answer.referenceImage = JSON.parse( process.env.CDNURL )?.TraxAnswerCDN+answer.referenceImage;
393
409
  }
394
410
  } );
395
411
  } );
@@ -793,14 +809,15 @@ export const update = async ( req, res ) => {
793
809
  section.questions[qIdx].answers[index].nestedQuestion = [];
794
810
  }
795
811
  if ( answer.showLinked ) {
812
+ // section.questions[qIdx].answers[nestedIndex].nestedQuestion.push( answer.linkedQuestion );
796
813
  if ( nestedIndex != -1 ) {
797
- if ( !section.questions[qIdx].answers[nestedIndex].nestedQuestion.includes( answer.linkedQuestion ) ) {
798
- section.questions[qIdx].answers[nestedIndex].nestedQuestion.push( answer.linkedQuestion );
799
- }
814
+ // if ( !section.questions[qIdx].answers[nestedIndex].nestedQuestion.includes( answer.linkedQuestion ) ) {
815
+ section.questions[qIdx].answers[nestedIndex].nestedQuestion.push( answer.linkedQuestion );
816
+ // }
800
817
  } else {
801
- if ( !section.questions[qIdx].answers[index].nestedQuestion.includes( answer.linkedQuestion ) ) {
802
- section.questions[qIdx].answers[index].nestedQuestion.push( answer.linkedQuestion );
803
- }
818
+ // if ( !section.questions[qIdx].answers[index].nestedQuestion.includes( answer.linkedQuestion ) ) {
819
+ section.questions[qIdx].answers[index].nestedQuestion.push( answer.linkedQuestion );
820
+ // }
804
821
  }
805
822
  let nestedLinkedQuestion = section.questions.find( ( item ) => item.qno == answer.linkedQuestion );
806
823
  if ( nestedLinkedQuestion ) {
@@ -818,6 +835,21 @@ export const update = async ( req, res ) => {
818
835
  }
819
836
  }
820
837
 
838
+ let checkNestedLevel = false;
839
+ section.questions.forEach( ( qns ) => {
840
+ qns.answers.forEach( ( answ ) => {
841
+ if ( answ.nestedQuestion.length > 20 ) {
842
+ checkNestedLevel = true;
843
+ }
844
+ } );
845
+ } );
846
+
847
+ console.log( checkNestedLevel, 'lebej' );
848
+
849
+ if ( checkNestedLevel ) {
850
+ return res.sendError( { message: 'Unable to create more than 20 linked questions' }, 400 );
851
+ }
852
+
821
853
  sectionList.push( {
822
854
  section: section.name,
823
855
  sectionOldName: section.oldName,
@@ -875,7 +907,7 @@ export const update = async ( req, res ) => {
875
907
  } );
876
908
  let compare = findDifferences( qn, question );
877
909
  if ( Object.keys( compare ).length && ( compare?.answerType || compare?.answers || compare?.linkType ) ) {
878
- questionList.questionEdit.push( { sectionName: ele.section, questions: [ { previous: qn, new: question } ] } );
910
+ questionList.questionEdit.push( { sectionName: ele.section, questions: [ { previous: qn }, { new: question } ] } );
879
911
  }
880
912
  } else {
881
913
  let sectionIndex = questionList.questionDelete.findIndex( ( sec ) => sec.sectionName === ele.section );
@@ -971,11 +1003,11 @@ export const uploadImage = async ( req, res ) => {
971
1003
  };
972
1004
  imgUrl = await fileUpload( params );
973
1005
 
974
- let inputData = {
975
- Bucket: bucket.sop,
976
- file_path: imgUrl.Key,
977
- };
978
- imgUrl = await signedUrl( inputData );
1006
+ // let inputData = {
1007
+ // Bucket: bucket.sop,
1008
+ // file_path: imgUrl.Key,
1009
+ // };
1010
+ imgUrl = JSON.parse( process.env.CDNURL )?.TraxAnswerCDN+imgUrl.Key;
979
1011
  if ( !imgUrl ) {
980
1012
  return res.sendError( { message: 'Something went Wrong' }, 500 );
981
1013
  }
@@ -3402,7 +3434,6 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
3402
3434
  }
3403
3435
  if ( getsubmitDetails ) {
3404
3436
  getsubmitDetails = [ getsubmitDetails ];
3405
- console.log( submittedDetails, getsubmitDetails );
3406
3437
  }
3407
3438
  function findDifferences( obj1, obj2 ) {
3408
3439
  return Object.keys( obj1 ).reduce( ( diff, key ) => {
@@ -3433,11 +3464,14 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
3433
3464
  let findQuestion = getsubmitDetails[0].questionAnswers[index].questions.findIndex( ( ele ) => ele.qname.trim() == qns?.oldQname?.trim() || ele.qname.trim() == qns.qname.trim() );
3434
3465
  if ( findQuestion != -1 ) {
3435
3466
  let data = JSON.parse( JSON.stringify( getsubmitDetails[0].questionAnswers[index].questions[findQuestion] ) );
3436
- getsubmitDetails[0].questionAnswers[index].questions[findQuestion].qno = qns.qno;
3467
+ if ( getsubmitDetails[0].questionAnswers[index].questions[findQuestion].qno != qns.qno ) {
3468
+ question.push( { question: qns, type: 'noChange' } );
3469
+ }
3437
3470
  delete data.userAnswer;
3438
3471
  delete data.parentanswer;
3439
3472
  delete data.remarks;
3440
3473
  delete data.linkquestionenabled;
3474
+ delete data.uniqueNo;
3441
3475
  if ( data.descriptivetype == null ) {
3442
3476
  delete data.descriptivetype;
3443
3477
  }
@@ -3449,29 +3483,136 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
3449
3483
  delete ans.index;
3450
3484
  delete ans.validationAnswer;
3451
3485
  delete ans.answeroptionNumber;
3486
+ ans.nestedQuestion = ans?.oldNestedQuestion ? ans.oldNestedQuestion : ans.nestedQuestion;
3487
+ ans.linkedQuestion = ans?.oldLinkedQuestion ? ans.oldLinkedQuestion : ans.linkedQuestion;
3488
+ delete ans.oldNestedQuestion;
3489
+ delete ans.oldLinkedQuestion;
3452
3490
  } );
3453
3491
  const compare = findDifferences( data, qns );
3454
3492
  if ( compare?.answerType || compare?.answers || compare?.linkType ) {
3455
3493
  logger.info( 'compare =>', compare );
3494
+ logger.info( 'compareSection =>', { section: section.sectionName } );
3495
+ logger.info( 'qno =>', { qno: data.qno } );
3456
3496
  modifiedCount++;
3457
- question.push( qns );
3497
+ question.push( { question: qns, type: 'qnEdit' } );
3458
3498
  } else {
3459
- getsubmitDetails[0].questionAnswers[index].questions[findQuestion].qname = qns.qname;
3460
- question.push( getsubmitDetails[0].questionAnswers[index].questions[findQuestion] );
3499
+ if ( getsubmitDetails[0].questionAnswers[index].questions[findQuestion].qname != qns.qname ) {
3500
+ question.push( { type: 'nameChange', question: qns } );
3501
+ }
3502
+ // getsubmitDetails[0].questionAnswers[index].questions[findQuestion].qname = qns.qname;
3461
3503
  }
3462
3504
  } else {
3463
3505
  modifiedCount++;
3464
- question.push( qns );
3506
+ question.push( { question: qns, type: 'add' } );
3465
3507
  }
3466
3508
  } );
3467
- getsubmitDetails[0].questionAnswers[index].questions = question;
3468
- sectionList.push( getsubmitDetails[0].questionAnswers[index] );
3509
+ // getsubmitDetails[0].questionAnswers[index].questions = question;
3510
+ if ( question.length ) {
3511
+ sectionList.push( { sectionName: section.sectionName, oldName: section.sectionOldName, question: question, type: 'edit' } );
3512
+ }
3469
3513
  } else {
3470
3514
  modifiedCount++;
3471
- sectionList.push( section );
3515
+ sectionList.push( { section: section, type: 'add' } );
3472
3516
  }
3473
3517
  }
3474
- getsubmitDetails[0].questionAnswers = sectionList;
3518
+ let removed = [];
3519
+ getsubmitDetails[0].questionAnswers.forEach( ( section, sectionIdx ) => {
3520
+ let sectionIndex = questionList.findIndex( ( sec ) => section.sectionName == sec?.sectionOldName || section.sectionName == sec.sectionName );
3521
+ if ( sectionIndex == -1 ) {
3522
+ removed.push( { section: section.sectionName, type: 'delete' } );
3523
+ } else {
3524
+ let question = [];
3525
+ section.questions.forEach( ( qn ) => {
3526
+ let questionIndex = questionList[sectionIndex].questions.findIndex( ( ele ) => qn.qname.trim() == ele?.oldQname?.trim() || qn.qname.trim() == ele.qname.trim() );
3527
+ if ( questionIndex == -1 ) {
3528
+ question.push( qn.qname );
3529
+ }
3530
+ } );
3531
+ if ( question.length ) {
3532
+ removed.push( { section: section.sectionName, question: question, type: 'qnDelete' } );
3533
+ }
3534
+ }
3535
+ } );
3536
+ removed.forEach( ( ele ) => {
3537
+ if ( ele?.type == 'delete' ) {
3538
+ getsubmitDetails[0].questionAnswers = getsubmitDetails[0].questionAnswers.filter( ( section ) => section.sectionName != ele.section );
3539
+ } else {
3540
+ let sectionIndex = getsubmitDetails[0].questionAnswers.findIndex( ( section ) => section.sectionName == ele?.section );
3541
+ getsubmitDetails[0].questionAnswers[sectionIndex].questions = getsubmitDetails[0].questionAnswers[sectionIndex].questions.filter( ( qns ) => !qns.qname.includes( ele.question ) );
3542
+ }
3543
+ } );
3544
+
3545
+ // getsubmitDetails[0].questionAnswers = sectionList;
3546
+ logger.info( 'removedSections =>', { data: JSON.stringify( removed ) } );
3547
+ logger.info( 'modifiedSections =>', { data: JSON.stringify( sectionList ) } );
3548
+ sectionList.forEach( ( sec ) => {
3549
+ if ( sec.type == 'add' ) {
3550
+ getsubmitDetails[0].questionAnswers.push( sec.section );
3551
+ } else {
3552
+ sec.question.forEach( ( qn ) => {
3553
+ let sectionDetails = getsubmitDetails[0].questionAnswers.findIndex( ( section ) => section.sectionName == sec?.oldName || section.sectionName == sec.sectionName );
3554
+ if ( qn.type == 'add' ) {
3555
+ getsubmitDetails[0].questionAnswers[sectionDetails].questions.push( qn.question );
3556
+ } else {
3557
+ let questions = getsubmitDetails[0].questionAnswers[sectionDetails].questions.reduce( ( acc, ele, idx ) => {
3558
+ if ( ele.qname.trim() == qn?.question?.oldQname?.trim() || ele.qname.trim() == qn.question.qname.trim() ) {
3559
+ acc.push( idx );
3560
+ }
3561
+ return acc;
3562
+ }, [] );
3563
+ if ( questions.length && [ 'qnEdit', 'nameChange', 'noChange' ].includes( qn.type ) ) {
3564
+ if ( qn.type == 'qnEdit' ) {
3565
+ let checkLinkType = getsubmitDetails[0].questionAnswers[sectionDetails].questions[questions[0]].linkType;
3566
+ if ( checkLinkType && !qn.question.linkType ) {
3567
+ questions.forEach( ( qnIdx, index ) => {
3568
+ if ( index != 0 ) {
3569
+ getsubmitDetails[0].questionAnswers[sectionDetails].questions.splice( qnIdx, 1 );
3570
+ }
3571
+ } );
3572
+ questions = [ questions[0] ];
3573
+ }
3574
+ }
3575
+ questions.forEach( ( qnIdx ) => {
3576
+ if ( qn.type == 'qnEdit' ) {
3577
+ getsubmitDetails[0].questionAnswers[sectionDetails].questions[qnIdx].answers.forEach( ( ele ) => {
3578
+ console.log( ele?.nestedQuestion );
3579
+ if ( ele?.nestedQuestion.length ) {
3580
+ ele?.nestedQuestion.forEach( ( nested ) => {
3581
+ let findIndex = getsubmitDetails[0].questionAnswers[sectionDetails].questions.findIndex( ( qn ) => qn.uniqueNo == nested );
3582
+ if ( findIndex != -1 ) {
3583
+ delete getsubmitDetails[0].questionAnswers[sectionDetails].questions[findIndex].userAnswer;
3584
+ let questionDetails = getsubmitDetails[0].questionAnswers[sectionDetails].questions[findIndex];
3585
+ let checkQuestionExists = getsubmitDetails[0].questionAnswers[sectionDetails].questions.filter( ( qnDetails ) => qnDetails.qname == questionDetails.qname );
3586
+ if ( checkQuestionExists.length > 1 ) {
3587
+ getsubmitDetails[0].questionAnswers[sectionDetails].questions.splice( findIndex, 1 );
3588
+ } else {
3589
+ delete getsubmitDetails[0].questionAnswers[sectionDetails].questions[findIndex].uniqueNo;
3590
+ getsubmitDetails[0].questionAnswers[sectionDetails].questions[findIndex].linkquestionenabled = false;
3591
+ getsubmitDetails[0].questionAnswers[sectionDetails].questions[findIndex].answers.forEach( ( ele ) => {
3592
+ if ( ele?.oldNestedQuestion?.length ) {
3593
+ ele.nestedQuestion = ele.oldNestedQuestion;
3594
+ ele.linkedQuestion = ele.oldLinkedQuestion;
3595
+ }
3596
+ } );
3597
+ }
3598
+ }
3599
+ } );
3600
+ }
3601
+ } );
3602
+ getsubmitDetails[0].questionAnswers[sectionDetails].questions[qnIdx] = qn.question;
3603
+ } else {
3604
+ if ( qn.type == 'nameChange' ) {
3605
+ getsubmitDetails[0].questionAnswers[sectionDetails].questions[qnIdx].qname = qn.question.qname;
3606
+ } else {
3607
+ getsubmitDetails[0].questionAnswers[sectionDetails].questions[qnIdx].qno = qn.question.qno;
3608
+ }
3609
+ }
3610
+ } );
3611
+ }
3612
+ }
3613
+ } );
3614
+ }
3615
+ } );
3475
3616
  if ( modifiedCount ) {
3476
3617
  getsubmitDetails[0].checklistStatus = 'inprogress';
3477
3618
  getsubmitDetails[0].date_string = dayjs( currentdate ).format( 'YYYY-MM-DD' );
@@ -3480,6 +3621,7 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
3480
3621
  getsubmitDetails[0].approvalStatus = false;
3481
3622
  }
3482
3623
  let data = { ...getsubmitDetails[0]._doc };
3624
+ logger.info( 'modifiedData =>', { data: JSON.stringify( data ) } );
3483
3625
  await processedchecklist.updateOne( { _id: getsubmitDetails[0]._id }, data );
3484
3626
  if ( editSubmit && getsubmitDetails[0].checklistStatus == 'submit' ) {
3485
3627
  let user = {
@@ -3879,7 +4021,12 @@ export const selectAssign = async ( req, res ) => {
3879
4021
  // //Select Store and cluster
3880
4022
  if ( requestData.assignType == 'store' ) {
3881
4023
  let storeQuery = [
3882
- { $match: { clientId: requestData.clientId, status: 'active' } },
4024
+ {
4025
+ $match: {
4026
+ ...( req.user.userType==='client'&&req.user.role!='superadmin' ) ? { storeId: { $in: requestData?.assignedStores } } :{ clientId: requestData.clientId },
4027
+ status: 'active',
4028
+ },
4029
+ },
3883
4030
  {
3884
4031
  $project: {
3885
4032
  storeName: 1,
@@ -3809,7 +3809,8 @@ export async function sendAlert( req, res ) {
3809
3809
  }
3810
3810
  const fcmToken = item.token;
3811
3811
  try {
3812
- await sendPushNotification( title, description, fcmToken );
3812
+ let response = await sendPushNotification( title, description, fcmToken );
3813
+ console.log( response, 'response' );
3813
3814
  } catch ( e ) {
3814
3815
  logger.error( { message: 'send alert', error: e, details: data } );
3815
3816
  }
@@ -9,15 +9,18 @@ mobileRouter
9
9
  .get( '/storeList', isAllowedSessionHandler, mobileController.storeList )
10
10
  .get( '/storeListv1', isAllowedSessionHandler, mobileController.storeListv1 )
11
11
  .post( '/startCheckList', isAllowedSessionHandler, validate( startValidation ), mobileController.startChecklist )
12
+ .post( '/startCheckListv1', isAllowedSessionHandler, validate( startValidation ), mobileController.startChecklistv1 )
12
13
  .post( '/startTask', isAllowedSessionHandler, validate( startValidation ), mobileController.startTask )
13
14
  .post( '/submitCheckList', isAllowedSessionHandler, mobileController.sopMobilechecklistValidater, mobileController.sopMobilechecklistQuestionValidator, mobileController.sopMobilechecklistMultiSectionFormatter, mobileController.submitChecklist )
14
15
  .post( '/submitCheckListv5', isAllowedSessionHandler, mobileController.sopMobilechecklistValidater, mobileController.sopMobilechecklistQuestionValidatorv1, mobileController.sopMobilechecklistMultiSectionFormatterv1, mobileController.submitChecklist )
16
+ .post( '/submitCheckListv6', isAllowedSessionHandler, mobileController.sopMobilechecklistValidater, mobileController.sopMobilechecklistQuestionValidatorv1, mobileController.sopMobilechecklistMultiSectionFormatterv2, mobileController.submitChecklist )
15
17
  .post( '/submitTask', isAllowedSessionHandler, mobileController.sopMobilechecklistValidater, mobileController.sopMobileTaskQuestionValidator, mobileController.sopMobileTaskMultiSectionFormatter, mobileController.submitTask )
16
18
  .get( '/dashboard', isAllowedSessionHandler, validate( dashboardValidation ), mobileController.dashboard )
17
19
  .get( '/dashboardv1', isAllowedSessionHandler, validate( dashboardValidation ), mobileController.dashboardv1 )
18
20
  .get( '/checklist', isAllowedSessionHandler, validate( mobileChecklistValidation ), mobileController.checklist )
19
21
  .get( '/checklistv1', isAllowedSessionHandler, validate( mobileChecklistValidation ), mobileController.checklistv1 )
20
22
  .get( '/checklistQuestionList', isAllowedSessionHandler, mobileController.questionList )
23
+ .get( '/checklistQuestionListv1', isAllowedSessionHandler, mobileController.questionListv1 )
21
24
  .get( '/taskQuestionList', isAllowedSessionHandler, mobileController.taskQuestionList )
22
25
  .post( '/uploadAnswerImage', isAllowedSessionHandler, mobileController.uploadAnswerImage )
23
26
  .get( '/appVersion', mobileController.appVersion )
@@ -1,5 +1,5 @@
1
1
  import express from 'express';
2
- import { isAllowedSessionHandler, validate, accessVerification, isAllowedClient } from 'tango-app-api-middleware';
2
+ import { isAllowedSessionHandler, validate, accessVerification, isAllowedClient, getAssinedStore } from 'tango-app-api-middleware';
3
3
  import { checklistValidation, checklistDetailsValidation, runaiValidation, checklistPageSchema, duplicateValidation, updateChecklistValidation, uploadUserValidation, aichecklistValidation, publishValidation, selectAssign } from '../dtos/validation.dtos.js';
4
4
  import * as traxController from '../controllers/trax.controller.js';
5
5
 
@@ -25,7 +25,7 @@ traxRouter
25
25
  .get( '/zoneList', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ ] } ] } ), traxController.zoneList )
26
26
  .get( '/aichecklist', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ ] } ] } ), validate( aichecklistValidation ), traxController.aiChecklist )
27
27
  .get( '/predefinedChecklist', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ ] } ] } ), validate( aichecklistValidation ), traxController.preDefinedChecklist )
28
- .post( '/selectAssign', validate( selectAssign ), traxController.selectAssign )
28
+ .post( '/selectAssign', isAllowedSessionHandler, validate( selectAssign ), getAssinedStore, traxController.selectAssign )
29
29
  .post( '/assign', isAllowedSessionHandler, traxController.checklistAssign )
30
30
  // .post( '/assignUpload', isAllowedSessionHandler, traxController.assignChecklistUser )
31
31
  .post( '/updateAssign', isAllowedSessionHandler, traxController.updateAssign );