tango-app-api-trax 3.7.2-multireff-3 → 3.7.2-multireff-4

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.2-multireff-3",
3
+ "version": "3.7.2-multireff-4",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -17,6 +17,7 @@
17
17
  "body-parser": "^1.20.3",
18
18
  "dayjs": "^1.11.13",
19
19
  "dotenv": "^16.4.5",
20
+ "exceljs": "^4.4.0",
20
21
  "express": "^4.21.1",
21
22
  "express-fileupload": "^1.5.1",
22
23
  "firebase-admin": "^13.0.0",
@@ -26,7 +27,7 @@
26
27
  "mongodb": "^6.8.0",
27
28
  "nodemon": "^3.1.4",
28
29
  "path": "^0.12.7",
29
- "tango-api-schema": "^2.2.197",
30
+ "tango-api-schema": "^2.2.198",
30
31
  "tango-app-api-middleware": "^3.1.77",
31
32
  "url": "^0.11.4",
32
33
  "winston": "^3.13.1",
@@ -8,11 +8,11 @@ import * as processedchecklistconfigService from '../services/processedchecklist
8
8
  import * as processedChecklist from '../services/processedchecklist.services.js';
9
9
  import * as checklistLogs from '../services/checklistlog.service.js';
10
10
  import * as ApproverModel from '../services/approver.service.js';
11
-
11
+ import ExcelJS from 'exceljs';
12
12
  import mongoose from 'mongoose';
13
13
  import dayjs from 'dayjs';
14
14
  import { aggregateTeams, findteams } from '../services/teams.service.js';
15
- import { aggregate } from '../services/user.service.js';
15
+ import { aggregate, findOne } from '../services/user.service.js';
16
16
  // import axios from 'axios';
17
17
  import timeZone from 'dayjs/plugin/timezone.js';
18
18
  import customParseFormat from 'dayjs/plugin/customParseFormat.js';
@@ -289,7 +289,7 @@ export async function approveChecklist( req, res ) {
289
289
  toDate = new Date( toDate.getTime() - userTimezoneOffset );
290
290
  toDate.setUTCHours( 23, 59, 59, 59 );
291
291
  let query = { sourceCheckList_id: req.body.sourceCheckList_id, date_iso: { $gte: req.body.fromDate, $lte: toDate }, $or: [ { checklistStatus: 'submit' }, { redoStatus: true } ], approvalEnable: true };
292
- if ( !( req.body.assignedStores && req.body.assignedStores.length >0 ) ) {
292
+ if ( !( req.body.assignedStores && req.body.assignedStores.length > 0 ) ) {
293
293
  req.body.assignedStores = req.body.storeId;
294
294
  }
295
295
  if ( req.body?.storeId?.length ) {
@@ -318,13 +318,13 @@ export async function approveChecklist( req, res ) {
318
318
 
319
319
  let teamsMsg;
320
320
  let teamsAlertUrls = process.env.teamsAlertURL ? JSON.parse( process.env.teamsAlertURL ) : '';
321
- teamsMsg = 'ClientId: '+ checklistDetails[0].client_id + ', Type: Checklist, Process: started, Action: Approval, ChecklistId: '+ checklistDetails[0].sourceCheckList_id + ', Checklist Name: '+ checklistDetails[0].checkListName +', UpDatedBy: '+ req.user.email;
321
+ teamsMsg = 'ClientId: ' + checklistDetails[0].client_id + ', Type: Checklist, Process: started, Action: Approval, ChecklistId: ' + checklistDetails[0].sourceCheckList_id + ', Checklist Name: ' + checklistDetails[0].checkListName + ', UpDatedBy: ' + req.user.email;
322
322
  if ( teamsAlertUrls && teamsAlertUrls.approvalAlert ) {
323
323
  sendTeamsNotification( teamsAlertUrls.approvalAlert, teamsMsg );
324
324
  }
325
325
 
326
326
  if ( updateResponse.modifiedCount || updateResponse.matchedCount ) {
327
- teamsMsg = 'ClientId: '+ checklistDetails[0].client_id + ', Type: Checklist, Process: Completed, Updated Count: '+updateResponse.modifiedCount+' Action: Approval, ChecklistId: '+ checklistDetails[0].sourceCheckList_id + ', Checklist Name: '+ checklistDetails[0].checkListName +', UpDatedBy: '+ req.user.email;
327
+ teamsMsg = 'ClientId: ' + checklistDetails[0].client_id + ', Type: Checklist, Process: Completed, Updated Count: ' + updateResponse.modifiedCount + ' Action: Approval, ChecklistId: ' + checklistDetails[0].sourceCheckList_id + ', Checklist Name: ' + checklistDetails[0].checkListName + ', UpDatedBy: ' + req.user.email;
328
328
  if ( teamsAlertUrls && teamsAlertUrls.approvalAlert ) {
329
329
  sendTeamsNotification( teamsAlertUrls.approvalAlert, teamsMsg );
330
330
  }
@@ -360,7 +360,7 @@ export async function approveChecklist( req, res ) {
360
360
  let searchResponse = await fetch( url.approveChecklist, requestOptions );
361
361
  // console.log( searchResponse );
362
362
  const filteredStoreIds = req.body.storeId.filter( ( store ) => req.body.assignedStores.includes( store ) );
363
- let logData= {
363
+ let logData = {
364
364
  'client_id': checklistDetails[0].client_id,
365
365
  'createAt': new Date(),
366
366
  'sourceCheckList_id': req.body.sourceCheckList_id,
@@ -469,13 +469,13 @@ export async function redoChecklist( req, res ) {
469
469
  let response = await processedChecklist.updateOne( { _id: req.body.payload._id }, updateData );
470
470
  // console.log( response );
471
471
  if ( response.modifiedCount || response.matchedCount ) {
472
- let storeTimeZone = await storeService.findOne( { storeName: checklistDetails.storeName }, { 'storeProfile.timeZone': 1 } );
473
- let currentDateTime;
474
- if ( storeTimeZone?.storeProfile?.timeZone ) {
475
- currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
476
- } else {
477
- currentDateTime = dayjs();
478
- }
472
+ // let storeTimeZone = await storeService.findOne( { storeName: checklistDetails.storeName }, { 'storeProfile.timeZone': 1 } );
473
+ // let currentDateTime;
474
+ // if ( storeTimeZone?.storeProfile?.timeZone ) {
475
+ // currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
476
+ // } else {
477
+ // currentDateTime = dayjs();
478
+ // }
479
479
  data = {
480
480
  checklistId: checklistDetails.sourceCheckList_id,
481
481
  checkListName: checklistDetails.checkListName,
@@ -491,10 +491,10 @@ export async function redoChecklist( req, res ) {
491
491
  type: checklistDetails.checkListType,
492
492
  userAnswer: userAnswer,
493
493
  initiatedBy: req.user.userName,
494
- initiatedTime: dayjs.utc( currentDateTime.format( 'hh:mm:ss A, DD MMM YYYY' ), 'hh:mm:ss A, DD MMM YYYY' ).format(),
494
+ initiatedTime: dayjs.utc( ).format(),
495
495
  answerType: question[sectionIndex].questions[findQuestion].answerType,
496
496
  submitedBy: checklistDetails.userName,
497
- submitTime: checklistDetails.submitTime,
497
+ submitTime: dayjs.utc( checklistDetails.submitTime ).format(),
498
498
  };
499
499
  await checklistLogs.create( data );
500
500
 
@@ -547,7 +547,7 @@ export async function redomultiChecklist( req, res ) {
547
547
  try {
548
548
  let inputData = req.body.payload.coverage === 'user' ? req.body.payload.userEmail : req.body.payload.storeName;
549
549
 
550
-
550
+ let inputBody = req.body;
551
551
  for ( let originalData of inputData ) {
552
552
  if ( !originalData.checklistId ) {
553
553
  return res.sendError( 'Id is Required', 400 );
@@ -559,6 +559,15 @@ export async function redomultiChecklist( req, res ) {
559
559
  return res.sendError( 'Question number is Required', 400 );
560
560
  }
561
561
 
562
+ let findcomment = {};
563
+ if ( !inputBody.payload.showcomment ) {
564
+ if ( inputBody.payload?.coverage === 'store' ) {
565
+ findcomment = inputBody.payload.excelData.find( ( ele ) => ele['Store Name'] === originalData.storeName );
566
+ } else if ( inputBody.payload?.coverage === 'users' ) {
567
+ findcomment = inputBody.payload.excelData.find( ( ele ) => ele['User Email'] === originalData.userEmail );
568
+ }
569
+ }
570
+ console.log( '****************', findcomment );
562
571
 
563
572
  let checklistDetails = await processedChecklist.findOne( { _id: originalData.checklistId }, { questionAnswers: 1, redoStatus: 1, checklistStatus: 1, client_id: 1, store_id: 1, storeName: 1, checkListType: 1, sourceCheckList_id: 1, checkListName: 1, submitTime: 1, userName: 1, answerType: 1 } );
564
573
  if ( !checklistDetails ) {
@@ -574,7 +583,7 @@ export async function redomultiChecklist( req, res ) {
574
583
 
575
584
  let findQuestion = question[sectionIndex].questions.findIndex( ( ele ) => ele.qno == req.body.payload.qno );
576
585
 
577
- let data = { ...question[sectionIndex].questions[findQuestion], redo: true, redoComment: req.body.payload?.checklistDescription || '' };
586
+ let data = { ...question[sectionIndex].questions[findQuestion], redo: true, redoComment: req.body.payload?.showcomment ? req.body.payload?.checklistDescription : findcomment?.Comments };
578
587
  // if ( checklistDetails.client_id == '458' ) {
579
588
  data.answers.forEach( ( item ) => {
580
589
  if ( item.showLinked ) {
@@ -611,17 +620,17 @@ export async function redomultiChecklist( req, res ) {
611
620
  let response = await processedChecklist.updateOne( { _id: originalData.checklistId }, updateData );
612
621
  // console.log( response );
613
622
  if ( response.modifiedCount || response.matchedCount ) {
614
- let storeTimeZone = await storeService.findOne( { storeName: checklistDetails.storeName }, { 'storeProfile.timeZone': 1 } );
615
- let currentDateTime;
616
- if ( storeTimeZone?.storeProfile?.timeZone ) {
617
- currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
618
- } else {
619
- currentDateTime = dayjs();
620
- }
623
+ // let storeTimeZone = await storeService.findOne( { storeName: checklistDetails.storeName }, { 'storeProfile.timeZone': 1 } );
624
+ // let currentDateTime;
625
+ // if ( storeTimeZone?.storeProfile?.timeZone ) {
626
+ // currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
627
+ // } else {
628
+ // currentDateTime = dayjs();
629
+ // }
621
630
  data = {
622
631
  checklistId: checklistDetails.sourceCheckList_id,
623
632
  checkListName: checklistDetails.checkListName,
624
- checklistDescription: req.body.payload.checklistDescription,
633
+ checklistDescription: req.body.payload?.showcomment ? req.body.payload?.checklistDescription : findcomment?.comments,
625
634
  sectionId: originalData.section_id,
626
635
  sectionName: question[sectionIndex].sectionName,
627
636
  questionName: question[sectionIndex].questions[findQuestion].qname,
@@ -633,10 +642,10 @@ export async function redomultiChecklist( req, res ) {
633
642
  type: checklistDetails.checkListType,
634
643
  userAnswer: userAnswer,
635
644
  initiatedBy: req.user.userName,
636
- initiatedTime: dayjs.utc( currentDateTime.format( 'hh:mm:ss A, DD MMM YYYY' ), 'hh:mm:ss A, DD MMM YYYY' ).format(),
645
+ initiatedTime: dayjs.utc( ).format(),
637
646
  answerType: question[sectionIndex].questions[findQuestion].answerType,
638
647
  submitedBy: checklistDetails.userName,
639
- submitTime: checklistDetails.submitTime,
648
+ submitTime: dayjs.utc( checklistDetails.submitTime ).format(),
640
649
  };
641
650
  await checklistLogs.create( data );
642
651
 
@@ -644,7 +653,9 @@ export async function redomultiChecklist( req, res ) {
644
653
  req.body.payload._id = originalData.checklistId;
645
654
  req.body.payload.section_id = originalData.section_id;
646
655
  req.body.payload.uniqueNo = originalData.uniqueNo;
647
- // console.log( req.body );
656
+ console.log( req.body );
657
+
658
+ // return;
648
659
 
649
660
 
650
661
  const requestOptions = {
@@ -655,6 +666,7 @@ export async function redomultiChecklist( req, res ) {
655
666
  body: JSON.stringify( req.body ),
656
667
  };
657
668
  let url = JSON.parse( process.env.LAMBDAURL );
669
+ console.log( url.redoChecklist );
658
670
  let searchResponse = await fetch( url.redoChecklist, requestOptions );
659
671
  console.log( searchResponse.ok );
660
672
  let logData = {
@@ -749,6 +761,37 @@ export async function approvalstatus( req, res ) {
749
761
  }
750
762
 
751
763
 
764
+ let url = JSON.parse( process.env.LAMBDAURL );
765
+ let resultData = await LamdaServiceCall( url.approvalstatus, req.body );
766
+
767
+ if ( resultData ) {
768
+ if ( resultData.status_code == '200' ) {
769
+ return res.sendSuccess( resultData );
770
+ } else {
771
+ return res.sendError( 'No Content', 204 );
772
+ }
773
+ } else {
774
+ return res.sendError( 'No Content', 204 );
775
+ }
776
+ } catch ( error ) {
777
+ logger.error( error, 'approvalstatus' );
778
+ return res.sendError( error, 500 );
779
+ }
780
+ }
781
+ export async function allapprovalstatus( req, res ) {
782
+ try {
783
+ if ( ( req?.user?.userType == 'client' && req.user.role == 'superadmin' ) ) {
784
+ let url = JSON.parse( process.env.LAMBDAURL );
785
+ let resultData = await LamdaServiceCall( url.approvalstatus, req.body );
786
+ if ( resultData ) {
787
+ if ( resultData.status_code == '200' ) {
788
+ return res.sendSuccess( resultData );
789
+ }
790
+ }
791
+ return res.sendError( 'No Content', 204 );
792
+ }
793
+
794
+
752
795
  let url = JSON.parse( process.env.LAMBDAURL );
753
796
  let resultData = await LamdaServiceCall( url.approvalstatus, req.body );
754
797
 
@@ -1148,7 +1191,35 @@ export async function checkNotificationCount( req, res ) {
1148
1191
  return res.sendError( { error: error }, 500 );
1149
1192
  }
1150
1193
  }
1194
+ export async function taskvalidateUserData( req, res ) {
1195
+ try {
1196
+ let error = [];
1197
+ if ( req.body.coverage === 'store' ) {
1198
+ for ( let [ index, store ] of req.body.assignedData.entries() ) {
1199
+ let findstore = await storeService.findOne( { clientId: req.body.clientId, storeName: store['Store Name'] } );
1200
+ console.log( findstore );
1201
+ if ( !findstore ) {
1202
+ error.push( `Invalid StoreName - C${index + 2}` );
1203
+ }
1204
+ }
1205
+ }
1206
+ if ( req.body.coverage === 'users' ) {
1207
+ for ( let [ index, user ] of req.body.assignedData.entries() ) {
1208
+ let finduser = await findOne( { clientId: req.body.clientId, email: user['User Email'] } );
1209
+ if ( !finduser ) {
1210
+ error.push( `Invalid userEmail - C${index + 2}` );
1211
+ }
1212
+ }
1213
+ }
1214
+ if ( error.length ) {
1215
+ return res.sendError( error, 400 );
1216
+ }
1151
1217
 
1218
+ res.sendSuccess( 'success' );
1219
+ } catch ( error ) {
1220
+ logger.error( { error: error, function: 'taskvalidateUserData' } );
1221
+ }
1222
+ }
1152
1223
  export async function vehicleCheckInUpdate( req, res ) {
1153
1224
  try {
1154
1225
  let requestData = req.body;
@@ -1170,3 +1241,71 @@ export async function vehicleCheckInUpdate( req, res ) {
1170
1241
  return res.sendError( { error: error }, 500 );
1171
1242
  }
1172
1243
  }
1244
+ export async function getallchecklist( req, res ) {
1245
+ try {
1246
+ let url = JSON.parse( process.env.LAMBDAURL );
1247
+ console.log( url.getallchecklist );
1248
+
1249
+ let resultData = await LamdaServiceCall( url.getallchecklist, req.body );
1250
+ console.log( resultData );
1251
+ if ( resultData ) {
1252
+ if ( resultData.status_code == '200' ) {
1253
+ resultData.message = '';
1254
+ return res.sendSuccess( resultData );
1255
+ } else {
1256
+ return res.sendError( 'No Content', 204 );
1257
+ }
1258
+ } else {
1259
+ return res.sendError( 'No Content', 204 );
1260
+ }
1261
+ } catch ( error ) {
1262
+ logger.error( { error: error, function: 'getallchecklist' } );
1263
+ return res.sendError( { error: error }, 500 );
1264
+ }
1265
+ }
1266
+ export async function exportTemplate( req, res ) {
1267
+ try {
1268
+ const workbook = new ExcelJS.Workbook();
1269
+ const worksheet = workbook.addWorksheet( 'Sheet1' );
1270
+ if ( req.body.coverage === 'store' ) {
1271
+ worksheet.addRow( [ 'Checklist Name', 'Question Name', 'Store Name', 'Comments' ] );
1272
+ } else {
1273
+ worksheet.addRow( [ 'Checklist Name', 'Question Name', 'User Email', 'Comments' ] );
1274
+ }
1275
+ for ( let data of req.body.excelData ) {
1276
+ worksheet.addRow( [ data.checklistName, data.questionName, req.body.coverage === 'store'?data.storeName:data.userEmail, '' ] );
1277
+ }
1278
+ worksheet.eachRow( ( row, rowNumber ) => {
1279
+ row.eachCell( { includeEmpty: true }, ( cell, colNumber ) => {
1280
+ if ( colNumber === 1 || colNumber === 2 || colNumber === 3 ) {
1281
+ cell.protection = { locked: true }; // Lock Name & Email
1282
+ } else {
1283
+ cell.protection = { locked: false }; // Unlock Phone
1284
+ }
1285
+ } );
1286
+ } );
1287
+
1288
+ // Protect the worksheet
1289
+ await worksheet.protect( 'yourPassword123', {
1290
+ selectLockedCells: true,
1291
+ selectUnlockedCells: true,
1292
+ formatCells: false,
1293
+ formatColumns: false,
1294
+ formatRows: false,
1295
+ insertColumns: false,
1296
+ insertRows: false,
1297
+ insertHyperlinks: false,
1298
+ deleteColumns: false,
1299
+ deleteRows: false,
1300
+ } );
1301
+
1302
+
1303
+ const buffer = await workbook.xlsx.writeBuffer();
1304
+ res.setHeader( 'Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' );
1305
+ res.setHeader( 'Content-Disposition', 'attachment; filename="Fixture Library.xlsx"' );
1306
+ return res.send( buffer );
1307
+ } catch ( error ) {
1308
+ logger.error( { error: error, function: 'exportTemplate' } );
1309
+ return res.sendError( { error: error }, 500 );
1310
+ }
1311
+ }
@@ -377,7 +377,7 @@ export async function startTask( req, res ) {
377
377
 
378
378
 
379
379
  let updatedNewData;
380
- if ( task.checkListFrom && task.checkListFrom == 'api' ) {
380
+ if ( task.checkListFrom && [ 'api', 'gallery' ].includes( task.checkListFrom ) ) {
381
381
  updatedNewData = {
382
382
  checklistStatus: 'inprogress',
383
383
  startMobileTime: requestData?.currentTime,
@@ -1521,6 +1521,9 @@ export async function sopMobileTaskMultiSectionFormatter( req, res, next ) {
1521
1521
  let structure = {};
1522
1522
  structure.qno = qaAnswers[j].qno;
1523
1523
  structure.qname = qaAnswers[j].qname;
1524
+ if ( qaAnswers[j].qcomment && qaAnswers[j].qcomment!='' ) {
1525
+ structure.qcomment = qaAnswers[j].qcomment;
1526
+ }
1524
1527
  structure.answerType = qaAnswers[j].answerType;
1525
1528
  structure.runAI = qaAnswers[j].runAI;
1526
1529
  structure.runAIDescription = qaAnswers[j].runAIDescription;
@@ -1569,6 +1572,9 @@ export async function sopMobileTaskMultiSectionFormatter( req, res, next ) {
1569
1572
  let structure = {};
1570
1573
  structure.qno = qaAnswers[j].qno;
1571
1574
  structure.qname = qaAnswers[j].qname;
1575
+ if ( qaAnswers[j].qcomment && qaAnswers[j].qcomment!='' ) {
1576
+ structure.qcomment = qaAnswers[j].qcomment;
1577
+ }
1572
1578
  structure.answerType = qaAnswers[j].answerType;
1573
1579
  structure.runAI = qaAnswers[j].runAI;
1574
1580
  structure.runAIDescription = qaAnswers[j].runAIDescription;
@@ -1620,6 +1626,9 @@ export async function sopMobileTaskMultiSectionFormatter( req, res, next ) {
1620
1626
  let structure = {};
1621
1627
  structure.qno = qaAnswers[j].qno;
1622
1628
  structure.qname = qaAnswers[j].qname;
1629
+ if ( qaAnswers[j].qcomment && qaAnswers[j].qcomment!='' ) {
1630
+ structure.qcomment = qaAnswers[j].qcomment;
1631
+ }
1623
1632
  structure.answerType = qaAnswers[j].answerType;
1624
1633
  structure.runAI = qaAnswers[j].runAI;
1625
1634
  structure.runAIDescription = qaAnswers[j].runAIDescription;
@@ -1676,6 +1685,9 @@ export async function sopMobileTaskMultiSectionFormatter( req, res, next ) {
1676
1685
  let structure = {};
1677
1686
  structure.qno = qaAnswers[j].qno;
1678
1687
  structure.qname = qaAnswers[j].qname;
1688
+ if ( qaAnswers[j].qcomment && qaAnswers[j].qcomment!='' ) {
1689
+ structure.qcomment = qaAnswers[j].qcomment;
1690
+ }
1679
1691
  structure.answerType = qaAnswers[j].answerType;
1680
1692
  structure.runAI = qaAnswers[j].runAI;
1681
1693
  structure.runAIDescription = qaAnswers[j].runAIDescription;
@@ -1730,6 +1742,9 @@ export async function sopMobileTaskMultiSectionFormatter( req, res, next ) {
1730
1742
  let structure = {};
1731
1743
  structure.qno = qaAnswers[j].qno;
1732
1744
  structure.qname = qaAnswers[j].qname;
1745
+ if ( qaAnswers[j].qcomment && qaAnswers[j].qcomment!='' ) {
1746
+ structure.qcomment = qaAnswers[j].qcomment;
1747
+ }
1733
1748
  structure.answerType = qaAnswers[j].answerType;
1734
1749
  structure.runAI = qaAnswers[j].runAI;
1735
1750
  structure.runAIDescription = qaAnswers[j].runAIDescription;
@@ -3978,13 +3993,12 @@ export async function questionListV1( req, res ) {
3978
3993
  for ( let [ secIndex, section ] of getchecklist[0].questionAnswers.entries() ) {
3979
3994
  for ( let [ questionIndex, question ] of section.questions.entries() ) {
3980
3995
  let Multianswer = [];
3981
- // if ( getchecklist[0].questionAnswers[secIndex].questions[questionIndex].questionReferenceImage && getchecklist[0].questionAnswers[secIndex].questions[questionIndex].questionReferenceImage !='' ) {
3982
- // getchecklist[0].questionAnswers[secIndex].questions[questionIndex].questionReferenceImage = await signedUrl( { file_path: decodeURIComponent( getchecklist[0].questionAnswers[secIndex].questions[questionIndex].questionReferenceImage ), Bucket: bucket.sop } );
3983
- // }
3984
3996
  if ( getchecklist[0].questionAnswers[secIndex].questions[questionIndex].multiQuestionReferenceImage && getchecklist[0].questionAnswers[secIndex].questions[questionIndex].multiQuestionReferenceImage.length>0 ) {
3985
3997
  let questionReff = getchecklist[0].questionAnswers[secIndex].questions[questionIndex].multiQuestionReferenceImage;
3986
3998
  for ( let qri = 0; qri < questionReff.length; qri++ ) {
3987
- getchecklist[0].questionAnswers[secIndex].questions[questionIndex].multiQuestionReferenceImage[qri].imageURL = `${cdnurl.TraxAnswerCDN}${getchecklist[0].questionAnswers[secIndex].questions[questionIndex].multiQuestionReferenceImage[qri].imageURL}`;
3999
+ if ( getchecklist[0].questionAnswers[secIndex].questions[questionIndex].multiQuestionReferenceImage[qri].imageURL ) {
4000
+ getchecklist[0].questionAnswers[secIndex].questions[questionIndex].multiQuestionReferenceImage[qri].imageURL = `${cdnurl.TraxAnswerCDN}${getchecklist[0].questionAnswers[secIndex].questions[questionIndex].multiQuestionReferenceImage[qri].imageURL}`;
4001
+ }
3988
4002
  }
3989
4003
  } else {
3990
4004
  getchecklist[0].questionAnswers[secIndex].questions[questionIndex].multiQuestionReferenceImage = [];
@@ -3994,7 +4008,6 @@ export async function questionListV1( req, res ) {
3994
4008
  let checkvalidation = null;
3995
4009
  if ( answer.validationAnswer && answer.validationAnswer !='' ) {
3996
4010
  if ( answer.validationType != 'Descriptive Answer' ) {
3997
- // checkvalidation = await signedUrl( { file_path: decodeURIComponent( answer.validationAnswer ), Bucket: bucket.sop } );
3998
4011
  checkvalidation = `${cdnurl.TraxAnswerCDN}${answer.validationAnswer}`;
3999
4012
  } else {
4000
4013
  checkvalidation = answer.validationAnswer;
@@ -4003,9 +4016,6 @@ export async function questionListV1( req, res ) {
4003
4016
  Multianswer.push( { 'answer': answer.answer, 'no': ansIndex, 'validationAnswer': checkvalidation } );
4004
4017
  getchecklist[0].questionAnswers[secIndex].questions[questionIndex].answers[ansIndex].index = ansIndex;
4005
4018
  }
4006
- // if ( answer.referenceImage != '' ) {
4007
- // getchecklist[0].questionAnswers[secIndex].questions[questionIndex].answers[ansIndex].referenceImage = await signedUrl( { file_path: decodeURIComponent( answer.referenceImage ), Bucket: bucket.sop } );
4008
- // }
4009
4019
  if ( answer.multiReferenceImage && answer.multiReferenceImage.length >0 ) {
4010
4020
  let ReffImg = answer.multiReferenceImage;
4011
4021
  for ( let ri = 0; ri < ReffImg.length; ri++ ) {
@@ -4013,23 +4023,19 @@ export async function questionListV1( req, res ) {
4013
4023
  }
4014
4024
  }
4015
4025
  if ( ( answer.validationType == 'Capture Image' || answer.validationType == 'Capture Video' ) && answer.validationAnswer && answer.validationAnswer != '' ) {
4016
- // getchecklist[0].questionAnswers[secIndex].questions[questionIndex].answers[ansIndex].validationAnswer = await signedUrl( { file_path: decodeURIComponent( answer.validationAnswer ), Bucket: bucket.sop } );
4017
4026
  getchecklist[0].questionAnswers[secIndex].questions[questionIndex].answers[ansIndex].validationAnswer = `${cdnurl.TraxAnswerCDN}${answer.validationAnswer}`;
4018
4027
  }
4019
4028
  }
4020
4029
  if ( question?.userAnswer ) {
4021
4030
  for ( let [ userAnsIndex, userAns ] of question.userAnswer.entries() ) {
4022
4031
  if ( ( userAns.validationType == 'Capture Image' || userAns.validationType == 'Capture Video' ) && userAns.validationAnswer && userAns.validationAnswer != '' ) {
4023
- // getchecklist[0].questionAnswers[secIndex].questions[questionIndex].userAnswer[userAnsIndex].validationAnswer = await signedUrl( { file_path: decodeURIComponent( userAns.validationAnswer ), Bucket: bucket.sop } );
4024
4032
  getchecklist[0].questionAnswers[secIndex].questions[questionIndex].userAnswer[userAnsIndex].validationAnswer = `${cdnurl.TraxAnswerCDN}${userAns.validationAnswer}`;
4025
4033
  }
4026
4034
  if ( [ 'image', 'descriptiveImage', 'video' ].includes( question.answerType ) && userAns.answer != '' ) {
4027
- // getchecklist[0].questionAnswers[secIndex].questions[questionIndex].userAnswer[userAnsIndex].answer = await signedUrl( { file_path: decodeURIComponent( userAns.answer ), Bucket: bucket.sop } );
4028
4035
  getchecklist[0].questionAnswers[secIndex].questions[questionIndex].userAnswer[userAnsIndex].answer = `${cdnurl.TraxAnswerCDN}${userAns.answer}`;
4029
4036
  }
4030
- if ( userAns.referenceImage != '' ) {
4031
- // getchecklist[0].questionAnswers[secIndex].questions[questionIndex].userAnswer[userAnsIndex].referenceImage = await signedUrl( { file_path: decodeURIComponent( userAns.referenceImage ), Bucket: bucket.sop } );
4032
- getchecklist[0].questionAnswers[secIndex].questions[questionIndex].userAnswer[userAnsIndex].referenceImage = `${cdnurl.TraxAnswerCDN}${userAns.referenceImage}`;
4037
+ if ( userAns.multiReferenceImage != '' ) {
4038
+ getchecklist[0].questionAnswers[secIndex].questions[questionIndex].userAnswer[userAnsIndex].multiReferenceImage = `${cdnurl.TraxAnswerCDN}${userAns.multiReferenceImage}`;
4033
4039
  }
4034
4040
  if ( question.answerType == 'multiplechoicemultiple' ) {
4035
4041
  let ansIndex = Multianswer.findIndex( ( item ) => item.answer == userAns.answer );
@@ -4039,7 +4045,6 @@ export async function questionListV1( req, res ) {
4039
4045
  }
4040
4046
  if ( question.answerType == 'multipleImage' ) {
4041
4047
  if ( userAns && userAns.answer && userAns.answer !='' ) {
4042
- // let manswer = await signedUrl( { file_path: decodeURIComponent( userAns.answer ), Bucket: bucket.sop } );
4043
4048
  let manswer = `${cdnurl.TraxAnswerCDN}${userAns.answer}`;
4044
4049
  Multianswer.push( { 'answer': manswer, 'no': userAnsIndex, 'validationAnswer': '' } );
4045
4050
  } else {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { getchecklist, viewchecklist, getMobileUseagelist, storeOpencloselist, getcustomerunattendedlist,
4
4
  storesList, checklistDropdown, redoChecklist, redomultiChecklist, approveChecklist,
5
- approvalstatus, getLogs, headerStoresV2, teamsList, userList, checkNotificationCount, vehicleCheckInUpdate } from '../controllers/gallery.controller.js';
5
+ approvalstatus, allapprovalstatus, getLogs, headerStoresV2, teamsList, userList, checkNotificationCount, vehicleCheckInUpdate, taskvalidateUserData, getallchecklist, exportTemplate } from '../controllers/gallery.controller.js';
6
6
  import express from 'express';
7
7
  export const galleryRouter = express.Router();
8
8
  import { validate, isAllowedSessionHandler, isAllowedClient, getAssinedStore } from 'tango-app-api-middleware';
@@ -28,9 +28,13 @@ galleryRouter
28
28
  .post( '/redo', isAllowedSessionHandler, redoChecklist )
29
29
  .post( '/multiredo', isAllowedSessionHandler, redomultiChecklist )
30
30
  .post( '/approvalstatus', isAllowedSessionHandler, approvalstatus )
31
+ .post( '/allapprovalstatus', isAllowedSessionHandler, allapprovalstatus )
31
32
  .post( '/getLogs', isAllowedSessionHandler, getLogs )
32
33
  .post( '/headerStores_v2', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateHeaderParamsv2 ), getAssinedStore, headerStoresV2 )
33
34
  .get( '/teamsList', isAllowedSessionHandler, isAllowedClient, teamsList )
34
35
  .post( '/userList', isAllowedSessionHandler, isAllowedClient, userList )
36
+ .post( '/taskvalidateUserData', isAllowedSessionHandler, isAllowedClient, taskvalidateUserData )
35
37
  .post( '/checkNotificationCount', isAllowedSessionHandler, getAssinedStore, checkNotificationCount )
36
- .post( '/vehicleCheckInUpdate', isAllowedSessionHandler, vehicleCheckInUpdate );
38
+ .post( '/vehicleCheckInUpdate', isAllowedSessionHandler, vehicleCheckInUpdate )
39
+ .post( '/exportTemplate', isAllowedSessionHandler, exportTemplate )
40
+ .post( '/getallchecklist', isAllowedSessionHandler, getallchecklist );