tango-app-api-trax 3.7.61 → 3.7.63

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.61",
3
+ "version": "3.7.63",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -28,7 +28,6 @@
28
28
  "mongodb": "^6.8.0",
29
29
  "nodemon": "^3.1.4",
30
30
  "path": "^0.12.7",
31
- "puppeteer": "^24.39.0",
32
31
  "tango-api-schema": "^2.5.61",
33
32
  "tango-app-api-middleware": "^3.5.2",
34
33
  "url": "^0.11.4",
@@ -29,11 +29,8 @@ import * as cameraService from '../services/camera.service.js';
29
29
  dayjs.extend( isSameOrBefore );
30
30
  import * as pdf from 'html-pdf';
31
31
  import handlebars from './handlebar-helper.js';
32
- // import fs from 'fs';
33
- // import { fileURLToPath } from 'url';
34
- // import path from 'path';
35
- // const __filename = fileURLToPath( import.meta.url );
36
- // const __dirname = path.dirname( __filename );
32
+ import fs from 'fs';
33
+ import path from 'path';
37
34
 
38
35
  export async function storeList( req, res ) {
39
36
  try {
@@ -667,11 +664,12 @@ export async function sopMobilechecklistQuestionValidatorv1( req, res, next ) {
667
664
  // question.answers.forEach( ( answer ) => {
668
665
  let sectionQuestion = requestSection.filter( ( secQuestion ) => secQuestion.qname == question.oldQname || secQuestion.qname == question.qname );
669
666
  if ( sectionQuestion.length ) {
670
- if ( question.answerType == 'multiplechoicemultiple' || ( question.answerType =='dropdown' && question.allowMultiple ) && ( sectionQuestion[0].Multianswer == null || sectionQuestion[0].Multianswer == '' || !sectionQuestion[0].Multianswer.length ) ) {
667
+ if ( ( question.answerType == 'multiplechoicemultiple' || ( question.answerType =='dropdown' && question.allowMultiple ) ) && ( sectionQuestion[0].Multianswer == null || sectionQuestion[0].Multianswer == '' || !sectionQuestion[0].Multianswer.length ) ) {
671
668
  validationCount++;
672
669
  } else {
673
670
  if ( ![ 'multiplechoicemultiple', 'multipleImage' ].includes( question.answerType ) && ( question.answerType =='dropdown' && !question.allowMultiple ) && ( ( !sectionQuestion[0].linkType && ( sectionQuestion[0].answer == null || sectionQuestion[0].answer == '' ) ) || ( sectionQuestion[0].linkType && sectionQuestion[0].linkquestionenabled && ( sectionQuestion[0].answer == null || sectionQuestion[0].answer == '' ) ) ) ) {
674
671
  validationCount++;
672
+ console.log( question.qname );
675
673
  }
676
674
  }
677
675
  } else {
@@ -4599,18 +4597,18 @@ export async function downloadChecklist( req, res ) {
4599
4597
  if ( answer?.answer?.trim() && [ 'image', 'descriptiveImage', 'multipleImage', 'image/video' ].includes( question.answerType ) ) {
4600
4598
  answer.answer = 'https://d1r0hc2sskgmri.cloudfront.net/'+answer.answer;
4601
4599
  if ( question.answerType == 'multipleImage' ) {
4602
- console.log( answer.answer );
4603
4600
  }
4604
4601
  }
4605
4602
  } );
4606
4603
  } );
4607
4604
  } );
4608
- const templateHtml = readFileSync( join() + '/src/hbs/template.hbs', 'utf8' );
4605
+
4606
+ const templateHtml = fs.readFileSync( path.resolve( path.dirname( '' ) ) + '/src/hbs/template.hbs', 'utf8' );
4609
4607
  const template = handlebars.compile( templateHtml );
4610
4608
  const html = template( { data: checklistDetails } );
4611
- conosle.log( html );
4612
4609
  pdf.create( html ).toStream( ( err, stream ) => {
4613
4610
  if ( err ) {
4611
+ conosle.log( err );
4614
4612
  return res.status( 500 ).send( 'Error generating PDF' );
4615
4613
  }
4616
4614
 
@@ -4620,30 +4618,7 @@ export async function downloadChecklist( req, res ) {
4620
4618
  stream.pipe( res );
4621
4619
  } );
4622
4620
  } catch ( e ) {
4623
- console.log( e );
4624
4621
  console.log( 'getChecklistQuestionAnswers =>', e );
4625
4622
  return false;
4626
4623
  }
4627
4624
  }
4628
-
4629
- // async function convertUrltoBase64( url ) {
4630
- // try {
4631
- // const response = await fetch( url );
4632
-
4633
- // if ( !response.ok ) {
4634
- // throw new Error( 'Failed to fetch image' );
4635
- // }
4636
-
4637
- // const contentType = response.headers.get( 'content-type' );
4638
- // const arrayBuffer = await response.arrayBuffer();
4639
-
4640
- // const base64Image =
4641
- // `data:${contentType};base64,` +
4642
- // Buffer.from( arrayBuffer ).toString( 'base64' );
4643
-
4644
- // return base64Image;
4645
- // } catch ( error ) {
4646
- // // console.error( 'Error fetching image:', error.message );
4647
- // return false;
4648
- // }
4649
- // }