From e5da22df9a261aaa48e68edbc639d214d54f3934 Mon Sep 17 00:00:00 2001 From: Ean Milligan Date: Fri, 10 Apr 2026 14:15:52 -0400 Subject: [PATCH] list/read should only show non-deleted plans --- mod.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mod.ts b/mod.ts index e5a42d9..dac420f 100644 --- a/mod.ts +++ b/mod.ts @@ -53,16 +53,16 @@ Deno.serve({ port: config.api.port }, async (req) => { } else if (path.startsWith('/read/')) { const planId = path.replace('/read/', ''); - const plans = await dbClient.query('SELECT name, folder, data FROM plans WHERE id = ?', [planId]).catch(() => { + const plans = await dbClient.query('SELECT name, folder, data FROM plans WHERE id = ? AND deleted = 0', [planId]).catch(() => { failed = true; }); if (failed) return genericResponse(STATUS_CODE.InternalServerError, "Couldn't read DB."); - if (!plans.length) return genericResponse(STATUS_CODE.NotFound, 'Plan ID does not exist.'); + if (!plans.length) return genericResponse(STATUS_CODE.NotFound, 'Plan ID does not exist, maybe its marked as deleted?'); return genericResponse(STATUS_CODE.OK, JSON.stringify(plans[0])); } else if (path.startsWith('/list/')) { const userId = path.replace('/list/', ''); - const userMatch = await dbClient.query('SELECT id FROM users WHERE id = ?', [userId]).catch(() => { + const userMatch = await dbClient.query('SELECT id FROM users WHERE id = ? AND deleted = 0', [userId]).catch(() => { failed = true; }); if (failed) return genericResponse(STATUS_CODE.InternalServerError, "Couldn't read DB.");