IO-1177 Resolve deleting of raw files.

This commit is contained in:
Patrick Fic
2021-06-14 09:50:30 -07:00
parent bb2d62a11c
commit f8c1087360
4 changed files with 8 additions and 17 deletions

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.1 (20200629.0846)
-->
<!-- Title: G Pages: 1 -->
<svg width="43pt" height="43pt"
viewBox="0.00 0.00 43.20 43.20" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(21.6 21.6)">
<title>G</title>
<polygon fill="#111111" stroke="transparent" points="-21.6,21.6 -21.6,-21.6 21.6,-21.6 21.6,21.6 -21.6,21.6"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 613 B

View File

@@ -132,9 +132,13 @@ export const uploadToCloudinary = async (
//Insert the document with the matching key.
let takenat;
if (fileType.includes("image")) {
const exif = await exifr.parse(file);
try {
const exif = await exifr.parse(file);
takenat = exif && exif.DateTimeOriginal;
takenat = exif && exif.DateTimeOriginal;
} catch (error) {
console.log("Unable to parse image file for EXIF Data");
}
}
const documentInsert = await client.mutate({
mutation: INSERT_NEW_DOCUMENT,

View File

@@ -37,7 +37,7 @@ export default function JobsDocumentsDeleteButton({
}),
});
} else {
successfulDeletes.push(key);
successfulDeletes.push(key.replace(/\.[^/.]+$/, ""));
}
});
});

View File

@@ -60,7 +60,7 @@ exports.deleteFiles = async (req, res) => {
//delete images returns.push(
returns.push(
await cloudinary.api.delete_resources(
types.raw.map((x) => x.key),
types.raw.map((x) => `${x.key}.${x.extension}`),
{ resource_type: "raw" }
)
);