Skip to content

Commit

Permalink
added approved-accounts route (#59)
Browse files Browse the repository at this point in the history
Co-authored-by: Cheryl Chen <[email protected]>
Co-authored-by: ThatMegamind <[email protected]>
  • Loading branch information
3 people authored Mar 21, 2024
1 parent b23ac61 commit d49e349
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion routes/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d49e349

Please sign in to comment.