diff --git a/mod.ts b/mod.ts index 5e8862a..bdbaf04 100644 --- a/mod.ts +++ b/mod.ts @@ -67,9 +67,11 @@ Deno.serve({ port: config.api.port }, async (req) => { 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, lastUpdated FROM plans WHERE ownerId = ? AND deleted = 0', [userId]).catch(() => { - failed = true; - }); + const plans = await dbClient + .query('SELECT id, name, folder, lastUpdated FROM plans WHERE ownerId = ? AND deleted = 0 ORDER BY folder ASC,name ASC', [userId]) + .catch(() => { + failed = true; + }); if (failed) return genericResponse(STATUS_CODE.InternalServerError, "Couldn't read DB."); for (const plan of plans) {