From a54be40d416c6471192c51e8b1b079a96f7a1d54 Mon Sep 17 00:00:00 2001 From: mani <227445662+0xmanidev@users.noreply.github.com> Date: Thu, 25 Jun 2026 00:34:33 +0530 Subject: [PATCH 1/2] Add route to update last opened timestamp for space --- src/api/spaces/space.route.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/api/spaces/space.route.js b/src/api/spaces/space.route.js index 0b84534..2b98fed 100644 --- a/src/api/spaces/space.route.js +++ b/src/api/spaces/space.route.js @@ -133,7 +133,17 @@ router.post("/:spaceId/favorite", async (req, res) => { res.status(500).json({ error: err.message }); } }); +router.post('/:spaceId/open', async (req, res) => { + const { spaceId } = req.params; + + await pg('spaces') + .where('id', spaceId) + .update({ + last_opened_at: new Date() + }); + res.json({ success: true }); +}); router.post("/:spaceId/share/club", spaceShareLimiter, async (req, res) => { const { spaceId } = req.params; const { share } = req.body; From 2fa39137c51eb513b46c2176a4040072da8fa81e Mon Sep 17 00:00:00 2001 From: mani <227445662+0xmanidev@users.noreply.github.com> Date: Thu, 25 Jun 2026 00:43:29 +0530 Subject: [PATCH 2/2] Add openSpace function to handle space opening --- client/src/lib/Dashboard.svelte | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/client/src/lib/Dashboard.svelte b/client/src/lib/Dashboard.svelte index 4b36462..82091fd 100644 --- a/client/src/lib/Dashboard.svelte +++ b/client/src/lib/Dashboard.svelte @@ -49,6 +49,19 @@ console.error("Failed to load club data:", err); } } +async function openSpace(space) { + await fetch(`${API_BASE}/spaces/${space.id}/open`, { + method: "POST", + credentials: "include", + }); + + space.last_opened_at = new Date().toISOString(); + + window.open(space.access_url, "_blank"); +} + + window.open(space.access_url, '_blank'); +} async function loadSpaceShareStatuses() { for (const space of spaces) { @@ -722,14 +735,13 @@ $: filteredSpaces = sortedSpaces.filter(space => { {:else} {#if space.running || space.status?.toLowerCase() === "running"} {#if space.access_url} - openSpace(space)} > Open - +