add default sort to list

This commit is contained in:
Ean Milligan
2026-04-21 16:46:43 -04:00
parent 16ad0324e7
commit bf64ca9776

8
mod.ts
View File

@@ -67,9 +67,11 @@ Deno.serve({ port: config.api.port }, async (req) => {
if (failed) return genericResponse(STATUS_CODE.InternalServerError, "Couldn't read DB."); if (failed) return genericResponse(STATUS_CODE.InternalServerError, "Couldn't read DB.");
if (!userMatch.length) return genericResponse(STATUS_CODE.NotFound, 'User ID does not exist.'); 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(() => { const plans = await dbClient
failed = true; .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."); if (failed) return genericResponse(STATUS_CODE.InternalServerError, "Couldn't read DB.");
for (const plan of plans) { for (const plan of plans) {