tango-app-api-trax 3.7.60 → 3.7.61
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
|
+
"version": "3.7.61",
|
|
4
4
|
"description": "Trax",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"mongodb": "^6.8.0",
|
|
29
29
|
"nodemon": "^3.1.4",
|
|
30
30
|
"path": "^0.12.7",
|
|
31
|
+
"puppeteer": "^24.39.0",
|
|
31
32
|
"tango-api-schema": "^2.5.61",
|
|
32
33
|
"tango-app-api-middleware": "^3.5.2",
|
|
33
34
|
"url": "^0.11.4",
|
|
@@ -4592,27 +4592,15 @@ export async function downloadChecklist( req, res ) {
|
|
|
4592
4592
|
question.userAnswer.forEach( ( answer ) => {
|
|
4593
4593
|
if ( answer?.referenceImage?.trim() ) {
|
|
4594
4594
|
answer.referenceImage = 'https://d1r0hc2sskgmri.cloudfront.net/'+answer.referenceImage;
|
|
4595
|
-
// const base64Image = await convertUrltoBase64( url );
|
|
4596
|
-
// if ( base64Image ) {
|
|
4597
|
-
// answer.referenceImage = base64Image;
|
|
4598
|
-
// }
|
|
4599
4595
|
}
|
|
4600
4596
|
if ( answer.validationType == 'Capture Image' && answer?.validationAnswer?.trim() ) {
|
|
4601
4597
|
answer.validationAnswer = 'https://d1r0hc2sskgmri.cloudfront.net/'+answer.validationAnswer;
|
|
4602
|
-
// const base64Image = await convertUrltoBase64( url );
|
|
4603
|
-
// if ( base64Image ) {
|
|
4604
|
-
// answer.validationAnswer = base64Image;
|
|
4605
|
-
// }
|
|
4606
4598
|
}
|
|
4607
4599
|
if ( answer?.answer?.trim() && [ 'image', 'descriptiveImage', 'multipleImage', 'image/video' ].includes( question.answerType ) ) {
|
|
4608
4600
|
answer.answer = 'https://d1r0hc2sskgmri.cloudfront.net/'+answer.answer;
|
|
4609
4601
|
if ( question.answerType == 'multipleImage' ) {
|
|
4610
4602
|
console.log( answer.answer );
|
|
4611
4603
|
}
|
|
4612
|
-
// const base64Image = await convertUrltoBase64( url );
|
|
4613
|
-
// if ( base64Image ) {
|
|
4614
|
-
// answer.answer = base64Image;
|
|
4615
|
-
// }
|
|
4616
4604
|
}
|
|
4617
4605
|
} );
|
|
4618
4606
|
} );
|
|
@@ -4620,16 +4608,19 @@ export async function downloadChecklist( req, res ) {
|
|
|
4620
4608
|
const templateHtml = readFileSync( join() + '/src/hbs/template.hbs', 'utf8' );
|
|
4621
4609
|
const template = handlebars.compile( templateHtml );
|
|
4622
4610
|
const html = template( { data: checklistDetails } );
|
|
4623
|
-
|
|
4611
|
+
conosle.log( html );
|
|
4612
|
+
pdf.create( html ).toStream( ( err, stream ) => {
|
|
4624
4613
|
if ( err ) {
|
|
4625
|
-
res.status( 500 ).send( 'Error
|
|
4626
|
-
} else {
|
|
4627
|
-
res.setHeader( 'Content-Disposition', 'attachment; filename=checkListDetails.pdf' );
|
|
4628
|
-
res.contentType( 'application/pdf' );
|
|
4629
|
-
res.send( buffer );
|
|
4614
|
+
return res.status( 500 ).send( 'Error generating PDF' );
|
|
4630
4615
|
}
|
|
4616
|
+
|
|
4617
|
+
res.setHeader( 'Content-Type', 'application/pdf' );
|
|
4618
|
+
res.setHeader( 'Content-Disposition', 'attachment; filename=checkListDetails.pdf' );
|
|
4619
|
+
|
|
4620
|
+
stream.pipe( res );
|
|
4631
4621
|
} );
|
|
4632
4622
|
} catch ( e ) {
|
|
4623
|
+
console.log( e );
|
|
4633
4624
|
console.log( 'getChecklistQuestionAnswers =>', e );
|
|
4634
4625
|
return false;
|
|
4635
4626
|
}
|