tango-app-api-trax 3.7.61 → 3.7.62

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.62",
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 {
@@ -4599,16 +4596,15 @@ export async function downloadChecklist( req, res ) {
4599
4596
  if ( answer?.answer?.trim() && [ 'image', 'descriptiveImage', 'multipleImage', 'image/video' ].includes( question.answerType ) ) {
4600
4597
  answer.answer = 'https://d1r0hc2sskgmri.cloudfront.net/'+answer.answer;
4601
4598
  if ( question.answerType == 'multipleImage' ) {
4602
- console.log( answer.answer );
4603
4599
  }
4604
4600
  }
4605
4601
  } );
4606
4602
  } );
4607
4603
  } );
4608
- const templateHtml = readFileSync( join() + '/src/hbs/template.hbs', 'utf8' );
4604
+
4605
+ const templateHtml = fs.readFileSync( path.resolve( path.dirname( '' ) ) + '/src/hbs/template.hbs', 'utf8' );
4609
4606
  const template = handlebars.compile( templateHtml );
4610
4607
  const html = template( { data: checklistDetails } );
4611
- conosle.log( html );
4612
4608
  pdf.create( html ).toStream( ( err, stream ) => {
4613
4609
  if ( err ) {
4614
4610
  return res.status( 500 ).send( 'Error generating PDF' );
@@ -4620,30 +4616,7 @@ export async function downloadChecklist( req, res ) {
4620
4616
  stream.pipe( res );
4621
4617
  } );
4622
4618
  } catch ( e ) {
4623
- console.log( e );
4624
4619
  console.log( 'getChecklistQuestionAnswers =>', e );
4625
4620
  return false;
4626
4621
  }
4627
4622
  }
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
- // }