From 78910f0b66bcc50d70b9bb6c6e68188e87bdb7cb Mon Sep 17 00:00:00 2001 From: creations Date: Wed, 28 May 2025 08:19:50 -0400 Subject: [PATCH] add delete --- src/index.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/index.ts b/src/index.ts index 5d94d83..05806fc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -129,6 +129,17 @@ serve({ ); } + if (url.pathname === "/delete") { + const user = await auth.getUser(req); + if (!user) + return withCors( + Response.json({ error: "Unauthorized" }, { status: 401 }), + req, + ); + await sql`DELETE FROM timezones WHERE user_id = ${user.id}`; + return withCors(Response.json({ success: true }), req); + } + if (url.pathname === "/me") { const user = await auth.getUser(req); if (!user)