diff --git a/routes/users.js b/routes/users.js index 7f2ce2a..707a026 100644 --- a/routes/users.js +++ b/routes/users.js @@ -17,7 +17,20 @@ userRouter.get('/', async (req, res) => { userRouter.get('/pending-accounts', async (req, res) => { try { - const pendingAccounts = await db.query(`SELECT * FROM users WHERE approved = FALSE;`); + const pendingAccounts = await db.query( + `SELECT * FROM users WHERE approved = FALSE ORDER BY first_name ASC;`, + ); + res.status(200).json(keysToCamel(pendingAccounts)); + } catch (err) { + res.status(500).send(err.message); + } +}); + +userRouter.get('/approved-accounts', async (req, res) => { + try { + const pendingAccounts = await db.query( + `SELECT * FROM users WHERE approved = TRUE ORDER BY first_name ASC;`, + ); res.status(200).json(keysToCamel(pendingAccounts)); } catch (err) { res.status(500).send(err.message);