diff --git a/mod.ts b/mod.ts index 5b26838..36ebe5b 100644 --- a/mod.ts +++ b/mod.ts @@ -60,6 +60,14 @@ Deno.serve({ port: config.api.port }, async (req) => { return genericResponse(STATUS_CODE.OK, JSON.stringify(plans)); } else if (path.startsWith('/export/')) { + const userId = path.replace('/list/', ''); + const userMatch = await dbClient.query('SELECT id FROM users WHERE id = ?', [userId]).catch(() => { + failed = true; + }); + if (failed) return genericResponse(STATUS_CODE.InternalServerError, "Couldn't read DB."); + if (!userMatch.length) return genericResponse(STATUS_CODE.NotFound, 'User ID does not exist.'); + + // WIP: export plans to zip code goes here return genericResponse(STATUS_CODE.NotImplemented, 'WIP'); } } else if (req.method === 'POST' && path === '/enroll') {