diff --git a/package-lock.json b/package-lock.json index 86065e3..37d54ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2047,18 +2047,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/node": { - "version": "22.13.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.9.tgz", - "integrity": "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw==", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "undici-types": "~6.20.0" - } - }, "node_modules/@vitest/expect": { "version": "2.1.9", "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.9.tgz", @@ -2121,6 +2109,7 @@ "integrity": "sha512-ZXSSqTFIrzduD63btIfEyOmNcBmQvgOVsPNPe0jYtESiXkhd8u2erDLnMxmGrDCwHCCHE7hxwRDCT3pt0esT4g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@vitest/utils": "2.1.9", "pathe": "^1.1.2" @@ -2135,6 +2124,7 @@ "integrity": "sha512-oBO82rEjsxLNJincVhLhaxxZdEtV0EFHMK5Kmx5sJ6H9L183dHECjiefOAdnqpIgT5eZwT04PoggUnW88vOBNQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@vitest/pretty-format": "2.1.9", "magic-string": "^0.30.12", @@ -3049,6 +3039,7 @@ "dev": true, "hasInstallScript": true, "license": "MIT", + "peer": true, "bin": { "esbuild": "bin/esbuild" }, @@ -4878,8 +4869,7 @@ "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", "dev": true, "license": "MIT", - "optional": true, - "peer": true + "optional": true }, "node_modules/unenv": { "version": "2.0.0-rc.1", @@ -5016,6 +5006,7 @@ "integrity": "sha512-EK5cY7Q1D8JNhSaPKVK4pwBFvaTmZxEnoKXLG/U9gmdDcihQGNzFlgIvaxezFR4glP1LsuiedwMBqCXH3wZccA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.21.3", "postcss": "^8.4.43", @@ -5512,6 +5503,7 @@ "integrity": "sha512-MSmPM9REYqDGBI8439mA4mWhV5sKmDlBKWIYbA3lRb2PTHACE0mgKwA8yQ2xq9vxDTuk4iPrECBAEW2aoFXY0Q==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@vitest/expect": "2.1.9", "@vitest/mocker": "2.1.9", @@ -6732,6 +6724,7 @@ "integrity": "sha512-Wj7/AMtE9MRnAXa6Su3Lk0LNCfqDYgfwVjwRFVum9U7wsto1imuHqk4kTm7Jni+5A0Hn7dttL6O/zjvUvoo+8A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "defu": "^6.1.4", "exsolve": "^1.0.7", @@ -6747,6 +6740,7 @@ "dev": true, "hasInstallScript": true, "license": "Apache-2.0", + "peer": true, "bin": { "workerd": "bin/workerd" }, diff --git a/src/objects/bookings.js b/src/objects/bookings.js index af6fcba..6024652 100644 --- a/src/objects/bookings.js +++ b/src/objects/bookings.js @@ -92,7 +92,11 @@ export async function importSmoobuBookings(env) { .filter((booking) => booking !== null); // Get the current cache (source of truth) - const cachedBookings = (await getBookingsCache(env)) || []; + const cachedBookings = + (await getBookingsCache(env)).filter( + (booking) => + booking.status !== "cancelled" && booking.status !== "complete" + ) || []; // Diff Smoobu bookings with cache const { toAdd, toUpdate, toDelete } = diffBookings( smoobuBookings, diff --git a/src/routes/content.js b/src/routes/content.js index 6e4a224..b0f2973 100644 --- a/src/routes/content.js +++ b/src/routes/content.js @@ -13,7 +13,12 @@ export async function getCachedContent(env) { const noProperties = cachedContent.properties?.length === 0; const noPages = cachedContent.pages?.length === 0; - const noSettings = cachedContent.settings == {}; + const noSettings = + !cachedContent.settings || Object.keys(cachedContent.settings).length === 0; + + if (noSettings) { + cachedContent.settings = await importNotionSettings(env); + } if (noProperties || noPages || noSettings) { await importNotionNavigation(env); @@ -29,10 +34,6 @@ export async function getCachedContent(env) { cachedContent.images = await importImages(env); } - if (noSettings) { - cachedContent.settings = await importNotionSettings(env); - } - if (cachedContent) { return new Response( JSON.stringify({