From 79313eeff981d23abac223af931eb38c9c77789b Mon Sep 17 00:00:00 2001 From: Ean Milligan Date: Thu, 9 Apr 2026 23:07:52 -0400 Subject: [PATCH] Fix issue with PUT requests, everything so far is tested --- .bruno/Plan Endpoints/update plan.bru | 2 +- mod.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.bruno/Plan Endpoints/update plan.bru b/.bruno/Plan Endpoints/update plan.bru index 1df83d4..886dc0d 100644 --- a/.bruno/Plan Endpoints/update plan.bru +++ b/.bruno/Plan Endpoints/update plan.bru @@ -5,7 +5,7 @@ meta { } put { - url: http://localhost:14014/api/move/[planId] + url: http://localhost:14014/api/update/[planId] body: json auth: inherit } diff --git a/mod.ts b/mod.ts index df3bece..6d5909e 100644 --- a/mod.ts +++ b/mod.ts @@ -103,7 +103,7 @@ Deno.serve({ port: config.api.port }, async (req) => { failed = true; }); if (failed) return genericResponse(STATUS_CODE.InternalServerError, "Couldn't update DB."); - return genericResponse(STATUS_CODE.OK, 'Plan deleted.'); + return genericResponse(STATUS_CODE.OK, 'Plan restored.'); } else if (path.startsWith('/update/')) { const planId = path.replace('/update/', ''); const planMatch = await dbClient.query('SELECT ownerId FROM plans WHERE id = ?', [planId]).catch(() => { @@ -135,7 +135,7 @@ Deno.serve({ port: config.api.port }, async (req) => { if (failed) return genericResponse(STATUS_CODE.InternalServerError, "Couldn't update DB."); return genericResponse(STATUS_CODE.OK, 'Plan renamed.'); } else if (path.startsWith('/move/')) { - if (body.planName.trim().length > 200) return genericResponse(STATUS_CODE.BadRequest, 'Folder name too long.'); + if (body.folder.trim().length > 200) return genericResponse(STATUS_CODE.BadRequest, 'Folder name too long.'); const planId = path.replace('/move/', ''); const planMatch = await dbClient.query('SELECT ownerId FROM plans WHERE id = ?', [planId]).catch(() => { @@ -237,7 +237,8 @@ Deno.serve({ port: config.api.port }, async (req) => { } return genericResponse(STATUS_CODE.NotImplemented); - } catch (_e) { + } catch (e) { + console.error(e); return genericResponse(STATUS_CODE.InternalServerError); } });