tango-app-api-trax 3.7.3-runai-2 → 3.7.4-airtelv2-1

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": "3.7.3-runai-2",
3
+ "version": "3.7.4-airtelv2-1",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -27,7 +27,7 @@
27
27
  "mongodb": "^6.8.0",
28
28
  "nodemon": "^3.1.4",
29
29
  "path": "^0.12.7",
30
- "tango-api-schema": "^2.3.9",
30
+ "tango-api-schema": "^2.3.20",
31
31
  "tango-app-api-middleware": "^3.1.77",
32
32
  "url": "^0.11.4",
33
33
  "winston": "^3.13.1",
@@ -2556,28 +2556,3 @@ export async function updateRunAI( req, res ) {
2556
2556
  return res.sendError( e, 500 );
2557
2557
  }
2558
2558
  }
2559
-
2560
- export async function countUpdateRunAI( req, res ) {
2561
- try {
2562
- if ( !req.body.id ) {
2563
- return res.sendError( 'Checklist id is required', 400 );
2564
- }
2565
- if ( !req.body.runAICount ) {
2566
- return res.sendError( 'runAICount is required', 400 );
2567
- }
2568
- let getDetails = await processedchecklist.findOne( { _id: req.body.id } );
2569
- if ( !getDetails ) {
2570
- return res.sendError( 'No data found', 204 );
2571
- }
2572
-
2573
- let updateData = {
2574
- runAIFlag: req.body.runAICount,
2575
- };
2576
-
2577
- await processedchecklist.updateOne( { _id: req.body.id }, updateData );
2578
- return res.sendSuccess( 'RunAI Count updated successfully' );
2579
- } catch ( e ) {
2580
- logger.error( { functionName: 'updateRunAI', error: e } );
2581
- return res.sendError( e, 500 );
2582
- }
2583
- }
@@ -1334,13 +1334,12 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
1334
1334
  newAnswer.validationType = '';
1335
1335
  newAnswer.referenceImage = '';
1336
1336
  newAnswer.allowUploadfromGallery = false;
1337
+ newAnswer.runAI = false;
1337
1338
  newAnswer.descriptivetype = '';
1338
1339
  newAnswer.showLinked = false;
1339
1340
  newAnswer.linkedQuestion = 0;
1340
1341
  newAnswer.nestedQuestion = [];
1341
1342
  newAnswer.index = s;
1342
- newAnswer.runAI = qaAnswers[j].answers[0]?.runAI || false;
1343
- newAnswer.runAIFeatures = qaAnswers[j].answers[0]?.runAIFeatures || [];
1344
1343
  mcmi.push( newAnswer );
1345
1344
  }
1346
1345
  }
@@ -1401,8 +1400,6 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
1401
1400
  multiReferenceImage: qaAnswers[j].answers[0].multiReferenceImage || [],
1402
1401
  showLinked: qaAnswers[j].answers[0].showLinked,
1403
1402
  linkedQuestion: qaAnswers[j].answers[0].linkedQuestion,
1404
- runAI: qaAnswers[j].answers[0]?.runAI || false,
1405
- runAIFeatures: qaAnswers[j]?.answers[0]?.runAIFeatures || [],
1406
1403
  };
1407
1404
  if ( qaAnswers[j].answerType == 'date' ) {
1408
1405
  ansstructure.dateRangeType = requestSection[i].dateRangeType || false;
@@ -2931,7 +2928,7 @@ export async function checklistv1( req, res ) {
2931
2928
 
2932
2929
  const [ checklistResult, taskResult ] = await Promise.allSettled( [
2933
2930
  processedchecklist.aggregate( buildPipeline( [ { checkListType: 'custom' } ], { isPlano: 1, planoId: 1, planoType: 1, floorId: 1 } ) ),
2934
- processedTask.aggregate( taskBuildPipeline( [], { isPlano: 1, planoId: 1, planoType: 1, floorId: 1 } ) ),
2931
+ processedTask.aggregate( taskBuildPipeline( [], { isPlano: 1, planoId: 1, planoType: 1, floorId: 1, refTaskId: 1 } ) ),
2935
2932
  ] );
2936
2933
 
2937
2934
  const checklistData = checklistResult.status === 'fulfilled' ? checklistResult.value : [];
@@ -3006,7 +3006,9 @@ export const flagTablesV2 = async ( req, res ) => {
3006
3006
  } else if ( requestData?.filter === 'detection' ) {
3007
3007
  findAndQuery.push( { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum' ] } } );
3008
3008
  } else if ( requestData?.filter === 'runAI' ) {
3009
- findAndQuery.push( { checkListName: { $in: req.body.runAIChecklistName } } );
3009
+ if ( req.body.runAIChecklistName ) {
3010
+ findAndQuery.push( { checkListName: { $in: req.body.runAIChecklistName } } );
3011
+ }
3010
3012
  }
3011
3013
 
3012
3014
  findQuery.push( { $match: { $and: findAndQuery } } );
@@ -3186,7 +3188,7 @@ export const flagTablesV2 = async ( req, res ) => {
3186
3188
  getChecklistPerformanceData[index].flaggedStores = getChecklistPerformanceData[index].flaggedStores + findCheckList.flagCount;
3187
3189
  } else {
3188
3190
  getChecklistPerformanceData[index].flagCount = findCheckList.flagCount;
3189
- getChecklistPerformanceData[index].flaggedStores = findCheckList.flagCount;
3191
+ getChecklistPerformanceData[index].flaggedStores = findCheckList.flagStoreCount;
3190
3192
  }
3191
3193
  } else {
3192
3194
  if ( requestData?.filter == 'all' ) {
@@ -3222,22 +3224,28 @@ export const flagTablesV2 = async ( req, res ) => {
3222
3224
  const data = {
3223
3225
  'Checklist Name': element.checkListName,
3224
3226
  'Coverage': element?.coverage,
3227
+ 'No of Questions': element?.runAIQuestionCount,
3225
3228
  'Assigned Stores': element?.checkListType === 'custom' ? element?.assignedStores : element?.assignedStoresAi,
3226
3229
  'Flagged Stores': element?.flaggedStores,
3227
3230
  'Question Flags': element?.customQuestionFlagCount,
3228
3231
  ...( element.runAIFlag ? { 'Run AI Flag': element.runAIFlag } : {} ),
3229
3232
  'Not Submitted Flags': element?.customTimeFlagCount,
3230
3233
  'Detection Flags': element?.flagCount,
3234
+ 'Flags': element?.flagCount,
3231
3235
  'Compliance': element?.complianceRate,
3232
3236
  // 'Flag Type': element?.checkListType === 'custom' ? 'Question' : 'Detection',
3233
3237
  };
3234
- if ( requestData?.filter === 'question' ) {
3238
+ if ( requestData?.filter === 'all' ) {
3239
+ delete data['No of Questions'];
3240
+ delete data['Flags'];
3241
+ } else if ( requestData?.filter === 'question' ) {
3235
3242
  data['Flags'] = data['Question Flags'];
3236
3243
  delete data['Question Flags'];
3237
3244
  delete data['Flagged Count'];
3238
3245
  delete data['Not Submitted Flags'];
3239
3246
  delete data['Detection Flags'];
3240
3247
  delete data['Run AI Flag'];
3248
+ delete data['No of Questions'];
3241
3249
  } else if ( requestData?.filter === 'time' ) {
3242
3250
  data['Flags'] = data['Not Submitted Flags'];
3243
3251
  delete data['Question Flags'];
@@ -3245,7 +3253,16 @@ export const flagTablesV2 = async ( req, res ) => {
3245
3253
  delete data['Not Submitted Flags'];
3246
3254
  delete data['Detection Flags'];
3247
3255
  delete data['Run AI Flag'];
3256
+ delete data['No of Questions'];
3248
3257
  } else if ( requestData?.filter === 'detection' ) {
3258
+ data['Flags'] = data['Detection Flags'];
3259
+ delete data['Question Flags'];
3260
+ delete data['Flagged Count'];
3261
+ delete data['Not Submitted Flags'];
3262
+ delete data['Run AI Flag'];
3263
+ delete data['Flags'];
3264
+ delete data['No of Questions'];
3265
+ } else if ( requestData?.filter === 'runAI' ) {
3249
3266
  data['Flags'] = data['Detection Flags'];
3250
3267
  delete data['Question Flags'];
3251
3268
  delete data['Flagged Count'];
@@ -23,8 +23,6 @@ dayjs.extend( utc );
23
23
  dayjs.extend( customParseFormat );
24
24
  import * as clusterServices from '../services/cluster.service.js';
25
25
  import * as teamsServices from '../services/teams.service.js';
26
- import * as runAIFeatureServices from '../services/runAIFeatures.services.js';
27
- import * as runAIRequestServices from '../services/runAIRequest.services.js';
28
26
 
29
27
 
30
28
  export const checklist = async ( req, res ) => {
@@ -3853,7 +3851,7 @@ async function updateOpenSearch( user, data ) {
3853
3851
  export const aiChecklist = async ( req, res ) => {
3854
3852
  try {
3855
3853
  let storeDetails = await storeService.count( { clientId: req.query.clientId, status: 'active' } );
3856
- let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in' ];
3854
+ let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking' ];
3857
3855
  let checklistDetails = [];
3858
3856
  let publishList = [];
3859
3857
  let unpublishList = [];
@@ -4531,6 +4529,7 @@ export async function updateAiConfigure( req, res ) {
4531
4529
  }
4532
4530
  }
4533
4531
 
4532
+
4534
4533
  export async function getAiDetails( req, res ) {
4535
4534
  try {
4536
4535
  let storeList = [];
@@ -4588,162 +4587,3 @@ export async function getAiDetails( req, res ) {
4588
4587
  return res.sendError( e, 500 );
4589
4588
  }
4590
4589
  }
4591
-
4592
- export async function getRunAIFeatures( req, res ) {
4593
- try {
4594
- console.log( 'req.body =>', req.body );
4595
- let reqestData = req.body;
4596
- let getRunAIFeaturesQuery = [
4597
- {
4598
- $match: {
4599
- $or: [ { client_id: reqestData.client_id }, { client_id: { $exists: false } } ],
4600
- isdeleted: false,
4601
- },
4602
- },
4603
- { $addFields: { sortOrder: { $cond: [ { $eq: [ '$featureName', 'Others' ] }, 1, 0 ] } } },
4604
- { $sort: { sortOrder: 1, _id: 1 } },
4605
- { $project: { client_id: 1, featureName: 1, lableName: 1 } },
4606
- ];
4607
- let response = await runAIFeatureServices.aggregate( getRunAIFeaturesQuery );
4608
- if ( response && response.length > 0 ) {
4609
- return res.sendSuccess( response );
4610
- } else {
4611
- return res.sendError( 'No Features Available', 204 );
4612
- }
4613
- } catch ( e ) {
4614
- logger.error( { functionName: 'getRunAIFeatures', error: e } );
4615
- return res.sendError( e, 500 );
4616
- }
4617
- }
4618
-
4619
- export async function updateRunAIRequest( req, res ) {
4620
- try {
4621
- let inputBody = req.body;
4622
- inputBody.createdBy = req.user.email;
4623
- let checkRunAIRequestQuery = {
4624
- clientId: inputBody.clientId,
4625
- checkListId: inputBody.checkListId,
4626
- sectionNo: inputBody.sectionNo || '',
4627
- qname: inputBody.qname,
4628
- answer: inputBody.answer,
4629
- };
4630
- let checkRunAIRequest = await runAIRequestServices.findOne( checkRunAIRequestQuery );
4631
-
4632
- // runAI Features Updated
4633
- let incomeFeatures = inputBody.runAIFeatures;
4634
- for ( let i = 0; i < incomeFeatures.length; i++ ) {
4635
- // const element = array[i];
4636
- if ( incomeFeatures[i].featureName == 'Others' ) {
4637
- let insertData = {
4638
- 'client_id': inputBody.clientId,
4639
- 'featureName': incomeFeatures[i].lableName,
4640
- 'lableName': incomeFeatures[i].lableName,
4641
- };
4642
- console.log( 'insertData =>', insertData );
4643
- await runAIFeatureServices.create( insertData );
4644
- }
4645
- }
4646
- if ( checkRunAIRequest ) {
4647
- let updateRunAIRequest = await runAIRequestServices.updateOne( checkRunAIRequestQuery, inputBody );
4648
- if ( updateRunAIRequest ) {
4649
- return res.sendSuccess( updateRunAIRequest );
4650
- } else {
4651
- return res.sendError( 'something went wrong please Try again', 500 );
4652
- }
4653
- } else {
4654
- let insertRunAIRequest = await runAIRequestServices.create( inputBody );
4655
- if ( insertRunAIRequest ) {
4656
- return res.sendSuccess( insertRunAIRequest );
4657
- } else {
4658
- return res.sendError( 'something went wrong please Try again', 500 );
4659
- }
4660
- }
4661
- } catch ( e ) {
4662
- logger.error( { functionName: 'updateRunAIRequest', error: e } );
4663
- return res.sendError( e, 500 );
4664
- }
4665
- }
4666
-
4667
- export async function createChecklistName( req, res ) {
4668
- try {
4669
- // console.log( 'req.body =>', req.body );
4670
- let inputBody = req.body;
4671
- let checklistNameQuery = {
4672
- client_id: inputBody.clientId,
4673
- checkListName: inputBody.checkListName,
4674
- };
4675
- let checklistExist = await checklistService.findOne( checklistNameQuery );
4676
- if ( checklistExist ) {
4677
- return res.sendError( { message: 'checklist name Alrady Exist' }, 400 );
4678
- }
4679
-
4680
- let getMaxChecklistNumber = [
4681
- { $match: { client_id: inputBody.clientId } },
4682
- { $group: { _id: null, maxCheckListNumber: { $max: '$checkListNumber' } } },
4683
- ];
4684
- let maxChecklistNumber = await checklistService.aggregate( getMaxChecklistNumber );
4685
-
4686
- let checkListDetails = {
4687
- type: 'checklist',
4688
- checkListNumber: parseInt( maxChecklistNumber[0].maxCheckListNumber ) + 1,
4689
- checkListName: inputBody.checkListName,
4690
- checkListDescription: inputBody.checklistDescription,
4691
- createdBy: req.user._id,
4692
- createdByName: req.user.userName,
4693
- questionCount: 0,
4694
- client_id: req.body?.clientId,
4695
- owner: req.user.userType == 'client' ? [ { name: req.user.userName, value: req.user.email } ] : [],
4696
- runAIQuestionCount: 0,
4697
- };
4698
- let response = await checklistService.create( checkListDetails );
4699
- if ( response ) {
4700
- let insertSection = {
4701
- 'question': [
4702
- {
4703
- 'qno': 1,
4704
- 'qname': 'Q1',
4705
- 'answerType': 'descriptive',
4706
- 'runAI': false,
4707
- 'runAIDescription': '',
4708
- 'allowUploadfromGallery': false,
4709
- 'linkType': false,
4710
- 'multiQuestionReferenceImage': [],
4711
- 'descriptivetype': 'text',
4712
- 'questionReferenceImage': '',
4713
- 'answers': [
4714
- {
4715
- 'answer': '',
4716
- 'answeroptionNumber': 1,
4717
- 'sopFlag': false,
4718
- 'validation': false,
4719
- 'validationAnswer': '',
4720
- 'validationType': '',
4721
- 'multiReferenceImage': [],
4722
- 'showLinked': false,
4723
- 'linkedQuestion': 0,
4724
- 'referenceImage': '',
4725
- 'nestedQuestion': [],
4726
- },
4727
- ],
4728
- },
4729
- ],
4730
- 'section': 'Section 1',
4731
- 'checkList': inputBody.checkListName,
4732
- 'checkListId': new ObjectId( response._id ),
4733
- 'client_id': inputBody.clientId,
4734
- 'isdeleted': false,
4735
- 'sectionNumber': 1,
4736
- };
4737
- await questionService.create( insertSection );
4738
- let resultData = {
4739
- _id: response._id,
4740
- };
4741
- return res.sendSuccess( resultData );
4742
- } else {
4743
- return res.sendError( 'Something Went Wrong Please Try Again', 500 );
4744
- }
4745
- } catch ( e ) {
4746
- logger.error( { functionName: 'createChecklistName', error: e } );
4747
- return res.sendError( e, 500 );
4748
- }
4749
- }
@@ -339,7 +339,6 @@ export const checklistPerformance = async ( req, res ) => {
339
339
  },
340
340
  timeFlag: { $sum: '$timeFlag' },
341
341
  questionFlagCount: { $sum: '$questionFlag' },
342
- runAIFlagCount: { $sum: '$runAIFlag' },
343
342
  checkListType: { $last: '$checkListType' },
344
343
  redo: { $sum: { $cond: [ { $eq: [ '$redoStatus', true ] }, 1, 0 ] } },
345
344
  task: {
@@ -395,7 +394,7 @@ export const checklistPerformance = async ( req, res ) => {
395
394
  },
396
395
  storeCount: 1,
397
396
  submittedChecklist: 1,
398
- flaggedChecklist: { $add: [ '$timeFlag', '$questionFlagCount', '$runAIFlagCount' ] },
397
+ flaggedChecklist: { $add: [ '$timeFlag', '$questionFlagCount' ] },
399
398
  checkListType: 1,
400
399
  redo: 1,
401
400
  task: 1,
@@ -515,7 +514,6 @@ export const storePerformance = async ( req, res ) => {
515
514
  store_id: 1,
516
515
  storeName: 1,
517
516
  userEmail: 1,
518
- runAIFlag: 1,
519
517
  },
520
518
  } );
521
519
 
@@ -537,7 +535,6 @@ export const storePerformance = async ( req, res ) => {
537
535
  questionFlag: { $sum: { $cond: [ { $eq: [ '$checklistStatus', 'submit' ] }, '$questionFlag', 0 ] } },
538
536
  questionCount: { $sum: '$questionCount' },
539
537
  submitQuestionCount: { $sum: { $cond: [ { $eq: [ '$checklistStatus', 'submit' ] }, '$questionCount', 0 ] } },
540
- runAIFlag: { $sum: { $cond: [ { $eq: [ '$checklistStatus', 'submit' ] }, '$runAIFlag', 0 ] } },
541
538
  },
542
539
  } );
543
540
 
@@ -547,7 +544,7 @@ export const storePerformance = async ( req, res ) => {
547
544
  storeName: 1,
548
545
  userEmail: 1,
549
546
  checkListCount: { $sum: '$totalChecklist' },
550
- flaggedCount: { $add: [ '$timeFlag', '$questionFlag', '$runAIFlag' ] },
547
+ flaggedCount: { $add: [ '$timeFlag', '$questionFlag' ] },
551
548
  submittedChecklist: 1,
552
549
  checkListType: 1,
553
550
  questionCount: 1,
@@ -732,7 +729,6 @@ export const userPerformance = async ( req, res ) => {
732
729
  userName: 1,
733
730
  questionCount: 1,
734
731
  redoStatus: 1,
735
- runAIFlag: 1,
736
732
  },
737
733
  } );
738
734
 
@@ -751,7 +747,6 @@ export const userPerformance = async ( req, res ) => {
751
747
  $sum: { $cond: [ { $eq: [ '$checklistStatus', 'submit' ] }, '$questionCount', 0 ] },
752
748
  },
753
749
  redo: { $sum: { $cond: [ { $eq: [ '$redoStatus', true ] }, 1, 0 ] } },
754
- runAIFlag: { $sum: '$runAIFlag' },
755
750
  },
756
751
  } );
757
752
 
@@ -759,7 +754,7 @@ export const userPerformance = async ( req, res ) => {
759
754
  findQuery.push( {
760
755
  $addFields: {
761
756
  userName: '$_id',
762
- flaggedCount: { $add: [ '$timeFlag', '$questionFlag', '$runAIFlag' ] },
757
+ flaggedCount: { $add: [ '$timeFlag', '$questionFlag' ] },
763
758
  correctAnswers: { $subtract: [ '$submittedChecklistQuestionCount', '$questionFlag' ] },
764
759
  completion: {
765
760
  $round: [
@@ -1604,7 +1599,6 @@ export const checklistInfo = async ( req, res ) => {
1604
1599
  approvalByEmail: 1,
1605
1600
  approvalTime_string: 1,
1606
1601
  _id: 1,
1607
- runAIFlag: 1,
1608
1602
  },
1609
1603
  } );
1610
1604
 
@@ -1641,7 +1635,7 @@ export const checklistInfo = async ( req, res ) => {
1641
1635
  storeName: 1,
1642
1636
  checkListType: 1,
1643
1637
  scheduleRepeatedType: 1,
1644
- flaggedChecklist: { $add: [ '$timeFlag', '$questionFlag', '$runAIFlag' ] },
1638
+ flaggedChecklist: { $add: [ '$timeFlag', '$questionFlag' ] },
1645
1639
  timeFlag: 1,
1646
1640
  questionFlag: 1,
1647
1641
  date_iso: 1,
@@ -1656,7 +1650,6 @@ export const checklistInfo = async ( req, res ) => {
1656
1650
  approvalByEmail: 1,
1657
1651
  approvalTime_string: 1,
1658
1652
  _id: 1,
1659
- runAIFlag: 1,
1660
1653
  },
1661
1654
  } );
1662
1655
 
@@ -2613,7 +2606,6 @@ export const overallCardsV1 = async ( req, res ) => {
2613
2606
  totalQuestionCount: { $sum: '$questionCount' },
2614
2607
  totalQuestionFlagCount: { $sum: '$questionFlag' },
2615
2608
  totalTimeFlag: { $sum: '$timeFlag' },
2616
- totalRunAIFlag: { $sum: '$runAIFlag' },
2617
2609
  },
2618
2610
  } );
2619
2611
  findQuery.push( {
@@ -2632,7 +2624,6 @@ export const overallCardsV1 = async ( req, res ) => {
2632
2624
  questionCountSum: { $sum: '$totalQuestionCount' },
2633
2625
  questionFlagCountSum: { $sum: '$totalQuestionFlagCount' },
2634
2626
  timeFlagSum: { $sum: '$totalTimeFlag' },
2635
- runAIFlagSum: { $sum: '$totalRunAIFlag' },
2636
2627
  },
2637
2628
  } );
2638
2629
  findQuery.push( {
@@ -2651,7 +2642,6 @@ export const overallCardsV1 = async ( req, res ) => {
2651
2642
  statusCounts: 1,
2652
2643
  submittedChecklistQuestionCount: 1,
2653
2644
  submittedChecklistFlagQuestionCount: 1,
2654
- runAIFlagSum: 1,
2655
2645
  },
2656
2646
  } );
2657
2647
  findQuery.push( {
@@ -2661,7 +2651,7 @@ export const overallCardsV1 = async ( req, res ) => {
2661
2651
  openChecklist: { $ifNull: [ '$statusCounts.open', 0 ] },
2662
2652
  inprogressChecklist: { $ifNull: [ '$statusCounts.inprogress', 0 ] },
2663
2653
  submittedChecklist: { $ifNull: [ '$statusCounts.submit', 0 ] },
2664
- flaggedChecklist: { $add: [ { $ifNull: [ '$timeFlagSum', 0 ] }, { $ifNull: [ '$questionFlagCountSum', 0 ] }, { $ifNull: [ '$runAIFlagSum', 0 ] } ] },
2654
+ flaggedChecklist: { $add: [ { $ifNull: [ '$timeFlagSum', 0 ] }, { $ifNull: [ '$questionFlagCountSum', 0 ] } ] },
2665
2655
  completionScore: { $round: [ { $multiply: [ { $divide: [ { $ifNull: [ '$statusCounts.submit', 0 ] }, { $ifNull: [ '$totalChecklist', 0 ] } ] }, 100 ] }, 0 ] },
2666
2656
  // completionScore: { $multiply: [ { $divide: [ '$statusCounts.submit', '$totalChecklist' ] }, 100 ] },
2667
2657
  questionFlagCount: { $ifNull: [ '$questionFlagCountSum', 0 ] },
@@ -2867,7 +2857,6 @@ export const overallComparisonCardsV1 = async ( req, res ) => {
2867
2857
  totalQuestionCount: { $sum: '$questionCount' },
2868
2858
  totalQuestionFlagCount: { $sum: '$questionFlag' },
2869
2859
  totalTimeFlag: { $sum: '$timeFlag' },
2870
- totalRunAIFlag: { $sum: '$runAIFlag' },
2871
2860
  },
2872
2861
  },
2873
2862
  {
@@ -2886,7 +2875,6 @@ export const overallComparisonCardsV1 = async ( req, res ) => {
2886
2875
  questionCountSum: { $sum: '$totalQuestionCount' },
2887
2876
  questionFlagCountSum: { $sum: '$totalQuestionFlagCount' },
2888
2877
  timeFlagSum: { $sum: '$totalTimeFlag' },
2889
- runAIFlagSum: { $sum: '$totalRunAIFlag' },
2890
2878
  },
2891
2879
  },
2892
2880
  {
@@ -2905,7 +2893,6 @@ export const overallComparisonCardsV1 = async ( req, res ) => {
2905
2893
  statusCounts: 1,
2906
2894
  submittedChecklistQuestionCount: 1,
2907
2895
  submittedChecklistFlagQuestionCount: 1,
2908
- runAIFlagSum: 1,
2909
2896
  },
2910
2897
  },
2911
2898
  {
@@ -2915,7 +2902,7 @@ export const overallComparisonCardsV1 = async ( req, res ) => {
2915
2902
  openChecklist: { $ifNull: [ '$statusCounts.open', 0 ] },
2916
2903
  inprogressChecklist: { $ifNull: [ '$statusCounts.inprogress', 0 ] },
2917
2904
  submittedChecklist: { $ifNull: [ '$statusCounts.submit', 0 ] },
2918
- flaggedChecklist: { $add: [ { $ifNull: [ '$timeFlagSum', 0 ] }, { $ifNull: [ '$questionFlagCountSum', 0 ] }, { $ifNull: [ '$runAIFlagSum', 0 ] } ] },
2905
+ flaggedChecklist: { $add: [ { $ifNull: [ '$timeFlagSum', 0 ] }, { $ifNull: [ '$questionFlagCountSum', 0 ] } ] },
2919
2906
  completionScore: { $round: [ { $multiply: [ { $divide: [ { $ifNull: [ '$statusCounts.submit', 0 ] }, { $ifNull: [ '$totalChecklist', 0 ] } ] }, 100 ] }, 0 ] },
2920
2907
  // completionScore: { $multiply: [ { $divide: [ '$statusCounts.submit', '$totalChecklist' ] }, 100 ] },
2921
2908
  questionFlagCount: { $ifNull: [ '$questionFlagCountSum', 0 ] },
@@ -157,31 +157,4 @@ export const selectAssign = {
157
157
  body: selectAssignSchema,
158
158
  };
159
159
 
160
- export const createChecklistNameSchema = joi.object( {
161
- clientId: joi.string().required(),
162
- checkListName: joi.string().required(),
163
- checklistDescription: joi.string().optional(),
164
- } );
165
-
166
- export const createChecklistNameValidation = {
167
- body: createChecklistNameSchema,
168
- };
169
-
170
- export const runAIRequestSchema = joi.object( {
171
- clientId: joi.string().required(),
172
- checkListId: joi.string().required(),
173
- checkListName: joi.string().optional().allow( '' ),
174
- sectionNo: joi.number().required(),
175
- sectionName: joi.string().optional().allow( '' ),
176
- qname: joi.string().required(),
177
- answerType: joi.string().optional().allow( '' ),
178
- answer: joi.string().optional().allow( '' ),
179
- runAI: joi.boolean().required(),
180
- runAIFeatures: joi.array().optional().allow( '' ),
181
- } );
182
-
183
- export const runAIRequestValidation = {
184
- body: runAIRequestSchema,
185
- };
186
-
187
160
 
@@ -26,7 +26,6 @@ internalTraxRouter
26
26
  .post( '/getLiveChecklistClients', isAllowedInternalAPIHandler, internalController.getLiveChecklistClients )
27
27
  .post( '/notificationCreate', isAllowedInternalAPIHandler, internalController.notificationCreate )
28
28
  .post( '/insertAINotification', isAllowedInternalAPIHandler, internalController.insertAINotification )
29
- .post( '/updateRunAI', isAllowedInternalAPIHandler, internalController.updateRunAI )
30
- .post( '/countUpdateRunAI', isAllowedInternalAPIHandler, internalController.countUpdateRunAI );
29
+ .post( '/updateRunAI', isAllowedInternalAPIHandler, internalController.updateRunAI );
31
30
 
32
31
 
@@ -1,6 +1,6 @@
1
1
  import express from 'express';
2
2
  import { isAllowedSessionHandler, validate, accessVerification, isAllowedClient } from 'tango-app-api-middleware';
3
- import { checklistValidation, checklistDetailsValidation, runaiValidation, checklistPageSchema, duplicateValidation, updateChecklistValidation, uploadUserValidation, aichecklistValidation, publishValidation, selectAssign, createChecklistNameValidation, runAIRequestValidation } from '../dtos/validation.dtos.js';
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
 
6
6
  export const traxRouter = express.Router();
@@ -30,10 +30,7 @@ traxRouter
30
30
  // .post( '/assignUpload', isAllowedSessionHandler, traxController.assignChecklistUser )
31
31
  .post( '/updateAssign', isAllowedSessionHandler, traxController.updateAssign )
32
32
  .post( '/updateAiConfigure', isAllowedSessionHandler, traxController.updateAiConfigure )
33
- .get( '/getAiDetails', isAllowedSessionHandler, traxController.getAiDetails )
34
- .post( '/getRunAIFeatures', isAllowedSessionHandler, traxController.getRunAIFeatures )
35
- .post( '/updateRunAIFeatures', isAllowedSessionHandler, traxController.getRunAIFeatures )
36
- .post( '/updateRunAIRequest', isAllowedSessionHandler, validate( runAIRequestValidation ), traxController.updateRunAIRequest )
37
- .post( '/createChecklistName', isAllowedSessionHandler, validate( createChecklistNameValidation ), traxController.createChecklistName );
33
+ .get( '/getAiDetails', isAllowedSessionHandler, traxController.getAiDetails );
34
+ ;
38
35
 
39
36
  // isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ ] } ] } ),
@@ -1,31 +0,0 @@
1
- import model from 'tango-api-schema';
2
-
3
- export const findOne = async ( query={}, field={} ) => {
4
- return model.runAIFeaturesModel.findOne( query, field );
5
- };
6
-
7
- export const find = async ( query={}, field={} ) => {
8
- return model.runAIFeaturesModel.find( query, field );
9
- };
10
-
11
- export const create = async ( document = {} ) => {
12
- return model.runAIFeaturesModel.create( document );
13
- };
14
-
15
- export const deleteOne = async ( query = {} ) => {
16
- return model.runAIFeaturesModel.deleteOne( query );
17
- };
18
-
19
- export const updateOne = async ( query = {}, record={} ) => {
20
- return model.runAIFeaturesModel.updateOne( query, { $set: record } );
21
- };
22
-
23
- export const aggregate = async ( query = {} ) => {
24
- return model.runAIFeaturesModel.aggregate( query );
25
- };
26
-
27
- export const count = async ( query = {} ) => {
28
- return model.runAIFeaturesModel.countDocuments( query );
29
- };
30
-
31
-
@@ -1,31 +0,0 @@
1
- import model from 'tango-api-schema';
2
-
3
- export const findOne = async ( query={}, field={} ) => {
4
- return model.runAIRequestModel.findOne( query, field );
5
- };
6
-
7
- export const find = async ( query={}, field={} ) => {
8
- return model.runAIRequestModel.find( query, field );
9
- };
10
-
11
- export const create = async ( document = {} ) => {
12
- return model.runAIRequestModel.create( document );
13
- };
14
-
15
- export const deleteOne = async ( query = {} ) => {
16
- return model.runAIRequestModel.deleteOne( query );
17
- };
18
-
19
- export const updateOne = async ( query = {}, record={} ) => {
20
- return model.runAIRequestModel.updateOne( query, { $set: record } );
21
- };
22
-
23
- export const aggregate = async ( query = {} ) => {
24
- return model.runAIRequestModel.aggregate( query );
25
- };
26
-
27
- export const count = async ( query = {} ) => {
28
- return model.runAIRequestModel.countDocuments( query );
29
- };
30
-
31
-