add default sort to list
This commit is contained in:
4
mod.ts
4
mod.ts
@@ -67,7 +67,9 @@ 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
|
||||||
|
.query('SELECT id, name, folder, lastUpdated FROM plans WHERE ownerId = ? AND deleted = 0 ORDER BY folder ASC,name ASC', [userId])
|
||||||
|
.catch(() => {
|
||||||
failed = true;
|
failed = true;
|
||||||
});
|
});
|
||||||
if (failed) return genericResponse(STATUS_CODE.InternalServerError, "Couldn't read DB.");
|
if (failed) return genericResponse(STATUS_CODE.InternalServerError, "Couldn't read DB.");
|
||||||
|
|||||||
Reference in New Issue
Block a user