+
-
+
+
+
+
+
+
+
+
+
+
From 6c644818e611f8c8e2c3c6cc14d0586964045c31 Mon Sep 17 00:00:00 2001
From: Brian Tkatch
Date: Thu, 14 Nov 2024 09:59:41 -0500
Subject: [PATCH 53/55] Format one file
---
src/routes/quotation/+page.server.ts | 55 +++++++++++++++++++++-------
1 file changed, 42 insertions(+), 13 deletions(-)
diff --git a/src/routes/quotation/+page.server.ts b/src/routes/quotation/+page.server.ts
index 17ee18c..9afb568 100644
--- a/src/routes/quotation/+page.server.ts
+++ b/src/routes/quotation/+page.server.ts
@@ -15,13 +15,24 @@ export const actions = {
try {
// Retrieve and validate form data
- const depthCm = Math.ceil(parseFloat(formData.get("depth") as string) || 0);
- const widthCm = Math.ceil(parseFloat(formData.get("width") as string) || 0);
- const heightCm = Math.ceil(parseFloat(formData.get("height") as string) || 0);
- const weightG = Math.ceil(parseFloat(formData.get("weight") as string) || 0);
+ const depthCm = Math.ceil(
+ parseFloat(formData.get("depth") as string) || 0,
+ );
+ const widthCm = Math.ceil(
+ parseFloat(formData.get("width") as string) || 0,
+ );
+ const heightCm = Math.ceil(
+ parseFloat(formData.get("height") as string) || 0,
+ );
+ const weightG = Math.ceil(
+ parseFloat(formData.get("weight") as string) || 0,
+ );
if (!depthCm || !widthCm || !heightCm || !weightG) {
- return fail(400, { success: false, message: "Invalid package dimensions" });
+ return fail(400, {
+ success: false,
+ message: "Invalid package dimensions",
+ });
}
// Create the box
@@ -45,10 +56,18 @@ export const actions = {
// Ensure all address fields are provided
if (!originAddress1 || !originCity || !originCountry || !originPostal) {
- return fail(400, { success: false, message: "Error: One or many invalid origin address fields (Missing API Details)" });
+ return fail(400, {
+ success: false,
+ message:
+ "Error: One or many invalid origin address fields (Missing API Details)",
+ });
}
if (!destAddress1 || !destCity || !destCountry || !destPostal) {
- return fail(400, { success: false, message: "Error: One or many invalid destination address fields (Missing API Details)" });
+ return fail(400, {
+ success: false,
+ message:
+ "Error: One or many invalid destination address fields (Missing API Details)",
+ });
}
// Validate origin address using geocoding service
@@ -56,11 +75,14 @@ export const actions = {
originAddress1,
originCity,
originCountry,
- originPostal
+ originPostal,
);
if (!originGeocoding.valid) {
- return fail(400, { success: false, message: "Error: invalid origin address field (Missing API Details)" });
+ return fail(400, {
+ success: false,
+ message: "Error: invalid origin address field (Missing API Details)",
+ });
}
const originLat = originGeocoding.lat!;
@@ -71,11 +93,15 @@ export const actions = {
destAddress1,
destCity,
destCountry,
- destPostal
+ destPostal,
);
if (!destGeocoding.valid) {
- return fail(400, { success: false, message: "Error: invalid destination address field (Missing API Details)" });
+ return fail(400, {
+ success: false,
+ message:
+ "Error: invalid destination address field (Missing API Details)",
+ });
}
const destLat = destGeocoding.lat!;
@@ -106,7 +132,7 @@ export const actions = {
{ lat: destLat, lng: destLng },
{ depth: depthCm, width: widthCm, height: heightCm, weight: weightG },
originCountry,
- destCountry
+ destCountry,
);
// Save the quotation
@@ -131,7 +157,10 @@ export const actions = {
return { success: true, quotation: completeQuotation };
} catch (error) {
console.error("Error creating quotation:", error);
- return fail(500, { success: false, message: "Error creating quotation (MIssing Google Maps API Details)" });
+ return fail(500, {
+ success: false,
+ message: "Error creating quotation (MIssing Google Maps API Details)",
+ });
}
},
} as Actions;
From 020316aabb301c9720758871f8a1a68f336eef67 Mon Sep 17 00:00:00 2001
From: Brian Tkatch
Date: Thu, 14 Nov 2024 10:08:23 -0500
Subject: [PATCH 54/55] Add new env variable to github
---
.github/workflows/deploy-develop.yml | 1 +
.github/workflows/deploy-preview.yml | 1 +
.github/workflows/deploy-production.yml | 1 +
3 files changed, 3 insertions(+)
diff --git a/.github/workflows/deploy-develop.yml b/.github/workflows/deploy-develop.yml
index fd947cd..ec9b466 100644
--- a/.github/workflows/deploy-develop.yml
+++ b/.github/workflows/deploy-develop.yml
@@ -17,6 +17,7 @@ jobs:
DIRECT_DATABASE_URL: ${{ secrets.DIRECT_DATABASE_URL }}
SESSION_SIGNING_KEY: ${{ secrets.SESSION_SIGNING_KEY }}
EXEC_ENV: ${{ vars.EXEC_ENV }}
+ PUBLIC_GEOCODING_API_KEY: ${{ secrets.PUBLIC_GEOCODING_API_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v3
diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml
index 4b04b43..3481ce7 100644
--- a/.github/workflows/deploy-preview.yml
+++ b/.github/workflows/deploy-preview.yml
@@ -18,6 +18,7 @@ jobs:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
SESSION_SIGNING_KEY: ${{ secrets.SESSION_SIGNING_KEY }}
EXEC_ENV: ${{ vars.EXEC_ENV }}
+ PUBLIC_GEOCODING_API_KEY: ${{ secrets.PUBLIC_GEOCODING_API_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v3
diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml
index 9f28075..6d2b6b5 100644
--- a/.github/workflows/deploy-production.yml
+++ b/.github/workflows/deploy-production.yml
@@ -15,6 +15,7 @@ jobs:
DIRECT_DATABASE_URL: ${{ secrets.DIRECT_DATABASE_URL }}
SESSION_SIGNING_KEY: ${{ secrets.SESSION_SIGNING_KEY }}
EXEC_ENV: production
+ PUBLIC_GEOCODING_API_KEY: ${{ secrets.PUBLIC_GEOCODING_API_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v3
From 00bbfab63e8313eaaa60d3bc3cb888c332f58918 Mon Sep 17 00:00:00 2001
From: Brian Tkatch
Date: Thu, 14 Nov 2024 10:13:24 -0500
Subject: [PATCH 55/55] Fix/ignore lint issues
---
src/routes/quotation/+page.svelte | 24 ++----------------------
1 file changed, 2 insertions(+), 22 deletions(-)
diff --git a/src/routes/quotation/+page.svelte b/src/routes/quotation/+page.svelte
index 6a77ffe..701f13a 100644
--- a/src/routes/quotation/+page.svelte
+++ b/src/routes/quotation/+page.svelte
@@ -1,38 +1,18 @@
Additional Comments
+ +