Basic remote scrub.
This commit is contained in:
@@ -158,14 +158,16 @@ async function ImportJob(filepath: string): Promise<void> {
|
||||
|
||||
//Scrub the estimate
|
||||
const scrubResults = await ScrubEstimate({ job: jobObject });
|
||||
console.log("Scrub Results:", scrubResults);
|
||||
// UploadEmsToS3({
|
||||
// extensionlessFilePath,
|
||||
// bodyshopid: newAvailableJob.bodyshopid,
|
||||
// ciecaid: jobObject.ciecaid ?? "",
|
||||
// clm_no: jobObject.clm_no ?? "",
|
||||
// ownr_ln: jobObject.ownr_ln ?? "",
|
||||
// });
|
||||
|
||||
const esApiKey = store.get("settings.esApiKey") as string;
|
||||
UploadEmsToS3({
|
||||
extensionlessFilePath,
|
||||
esApiKey: esApiKey,
|
||||
ciecaid: jobObject.ciecaid ?? "",
|
||||
clm_no: jobObject.clm_no ?? "",
|
||||
ownr_ln: jobObject.ownr_ln ?? "",
|
||||
});
|
||||
console.log("Got past the job upload.");
|
||||
} catch (error) {
|
||||
log.error("Error encountered while decoding job. ", errorTypeCheck(error));
|
||||
const uploadNotificationFailure = new Notification({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import axios from "axios";
|
||||
import archiver from "archiver";
|
||||
import errorTypeCheck from "../../util/errorTypeCheck";
|
||||
import { UUID } from "crypto";
|
||||
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import stream from "stream";
|
||||
@@ -10,13 +10,13 @@ import store from "../store/store";
|
||||
|
||||
async function UploadEmsToS3({
|
||||
extensionlessFilePath,
|
||||
bodyshopid,
|
||||
esApiKey,
|
||||
clm_no,
|
||||
ciecaid,
|
||||
ownr_ln,
|
||||
}: {
|
||||
extensionlessFilePath: string;
|
||||
bodyshopid: UUID;
|
||||
esApiKey: string;
|
||||
clm_no: string;
|
||||
ciecaid: string;
|
||||
ownr_ln: string;
|
||||
@@ -63,21 +63,15 @@ async function UploadEmsToS3({
|
||||
|
||||
// Get the presigned URL from the server
|
||||
const presignedUrlResponse = await axios.post(
|
||||
`${
|
||||
store.get("app.isTest")
|
||||
? import.meta.env.VITE_API_TEST_URL
|
||||
: import.meta.env.VITE_API_URL
|
||||
}/emsupload`,
|
||||
"https://dev.es.imex.online/emsupload",
|
||||
{
|
||||
bodyshopid,
|
||||
esApiKey,
|
||||
ciecaid,
|
||||
clm_no,
|
||||
ownr_ln,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${await getTokenFromRenderer()}`,
|
||||
},
|
||||
headers: {},
|
||||
},
|
||||
);
|
||||
|
||||
@@ -95,6 +89,7 @@ async function UploadEmsToS3({
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error uploading EMS to S3:", errorTypeCheck(error));
|
||||
//TODO: Add some sort of remote logging here.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user