Basic remote scrub.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const { S3Client, PutObjectCommand } = require('@aws-sdk/client-s3');
|
||||
const { getSignedUrl } = require('@aws-sdk/s3-request-presigner');
|
||||
const { randomUUID } = require('crypto');
|
||||
|
||||
|
||||
const s3Client = new S3Client({ region: process.env.AWS_REGION || 'ca-central-1' });
|
||||
const BUCKET_NAME = process.env.UPLOAD_BUCKET_NAME;
|
||||
@@ -49,7 +49,7 @@ exports.handler = async (event) => {
|
||||
|
||||
// Generate a unique key for the upload
|
||||
|
||||
const key = `esdpuploads/${esApiKey}/${ciecaid}-${clm_no}-${ownr_ln}-${new Date().toISOString().replace(/T/, '--').replace(/\..+/, '').replace(/:/g, '-')}.zip`;
|
||||
const key = `${esApiKey}/${ciecaid}-${clm_no}-${ownr_ln}-${new Date().toISOString().replace(/T/, '--').replace(/\..+/, '').replace(/:/g, '-')}.zip`;
|
||||
|
||||
// Create the presigned URL for upload (valid for 15 minutes)
|
||||
const command = new PutObjectCommand({
|
||||
@@ -61,7 +61,8 @@ exports.handler = async (event) => {
|
||||
const presignedUrl = await getSignedUrl(s3Client, command, {
|
||||
expiresIn: 900 // 15 minutes
|
||||
});
|
||||
|
||||
console.log('Generated presigned URL for key:', key);
|
||||
console.log('Presigned URL:', presignedUrl);
|
||||
// Return success response with presigned URL and key
|
||||
return {
|
||||
statusCode: 200,
|
||||
|
||||
@@ -15,8 +15,6 @@ exports.handler = async (event) => {
|
||||
estimate.v_type = getVehicleType(estimate.v_model).type;
|
||||
estimate.sendingEntityId = "87330f61-412b-4251-baaa-d026565b23c5";
|
||||
|
||||
console.log("Updated type", estimate.v_type);
|
||||
|
||||
const fileName = `${esApiKey}-${estimate.clm_no}-${Date.now()}`;
|
||||
const formData = new FormData();
|
||||
const jsonString = JSON.stringify(estimate);
|
||||
@@ -46,7 +44,10 @@ exports.handler = async (event) => {
|
||||
const reportIssueUrl = `https://insurtechtoolkit.com/pcontactUs.aspx?apiKey=${esApiKey}&file=${fileName}.json`;
|
||||
|
||||
return {
|
||||
resultPDFUrl, reportIssueUrl
|
||||
statusCode: 200,
|
||||
body: JSON.stringify({
|
||||
resultPDFUrl, reportIssueUrl, identified_item: result.data?.identified_item
|
||||
}),
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user