whoops wrong db
This commit is contained in:
4
mod.ts
4
mod.ts
@@ -62,13 +62,13 @@ Deno.serve({ port: config.api.port }, async (req) => {
|
||||
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 = ? AND deleted = 0', [userId]).catch(() => {
|
||||
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.');
|
||||
|
||||
const plans = await dbClient.query('SELECT id, name, folder FROM plans WHERE ownerId = ?', [userId]).catch(() => {
|
||||
const plans = await dbClient.query('SELECT id, name, folder FROM plans WHERE ownerId = ? AND deleted = 0', [userId]).catch(() => {
|
||||
failed = true;
|
||||
});
|
||||
if (failed) return genericResponse(STATUS_CODE.InternalServerError, "Couldn't read DB.");
|
||||
|
||||
Reference in New Issue
Block a user