Skip to content

Commit

Permalink
remove delete from file conversion lambda as the file will now be rep…
Browse files Browse the repository at this point in the history
…lacing itself as a version update once the API is updated
  • Loading branch information
CEBergin-Vivid committed Apr 12, 2024
1 parent e2d74e2 commit cedf025
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions wfdm-image-converter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@ exports.handler = async (event) => {
fs.unlinkSync("/tmp/" + fileName);
fs.unlinkSync(jsonDataFilePath);

// with the converted succesfully converted, the original can be deleted
let deleteResponse = await deleteOriginalImage(apiURL, bearerToken, fileId);

if (deleteResponse !== '') {
console.log("failed to delete original image with fileId: " + fileId)
} else {
console.log("deleted original image with fileId: " + fileId)
}
}
}
}
Expand All @@ -140,33 +132,10 @@ exports.handler = async (event) => {
}


}


async function deleteOriginalImage(url, bearerToken, fileId) {
}

const axios = require('axios');

let config = {
method: 'delete',
maxBodyLength: Infinity,
url: url + fileId,
headers: {
'Authorization': 'Bearer ' + bearerToken
}
};

return Axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
return response.data
})
.catch((error) => {
console.log(error);
return error;
});

}

async function postImage(url, filePath, jsonDataFilePath, bearerToken) {
try {
Expand Down

0 comments on commit cedf025

Please sign in to comment.