Updates for packaging.

This commit is contained in:
Patrick Fic
2025-03-24 08:28:11 -07:00
parent a814326aa3
commit 4462cefb54
3 changed files with 26 additions and 21 deletions

View File

@@ -135,27 +135,25 @@ async function ImportJob(filepath: string): Promise<void> {
delete jobObject.clmt_ph2;
delete jobObject.clmt_ea;
// Save jobObject to a timestamped JSON file
const timestamp = new Date()
.toISOString()
.replace(/:/g, "-")
.replace(/\..+/, "");
const fileName = `job_${timestamp}_${parsedFilePath.name}.json`;
const logsDir = path.join(process.cwd(), "logs");
if (import.meta.env.DEV) {
// Save jobObject to a timestamped JSON file
const timestamp = new Date()
.toISOString()
.replace(/:/g, "-")
.replace(/\..+/, "");
const fileName = `job_${timestamp}_${parsedFilePath.name}.json`;
const logsDir = path.join(process.cwd(), "logs");
// Create logs directory if it doesn't exist
if (!fs.existsSync(logsDir)) {
fs.mkdirSync(logsDir, { recursive: true });
// Create logs directory if it doesn't exist
if (!fs.existsSync(logsDir)) {
fs.mkdirSync(logsDir, { recursive: true });
}
const filePath = path.join(logsDir, fileName);
fs.writeFileSync(filePath, JSON.stringify(jobObject, null, 2), "utf8");
log.info(`Job data saved to: ${filePath}`);
}
const filePath = path.join(logsDir, fileName);
fs.writeFileSync(filePath, JSON.stringify(jobObject, null, 2), "utf8");
log.info(`Job data saved to: ${filePath}`);
log.debug("Job Object", {
jobObject,
});
const newAvailableJob: AvailableJobSchema = {
uploaded_by: store.get("user.email"),
bodyshopid: store.get("app.bodyshop.id"),
@@ -183,7 +181,7 @@ async function ImportJob(filepath: string): Promise<void> {
newAvailableJob.est_data.vehicleid = existingVehicleRecord.vehicles[0].id;
}
console.log(newAvailableJob);
console.log("Available Job record to upload;", newAvailableJob);
const existingJobRecord: QueryJobByClmNoResult = await client.request(
QUERY_JOB_BY_CLM_NO_TYPED,