Skip to content

Commit

Permalink
added approved-accounts route
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheryl Chen committed Mar 7, 2024
1 parent 7095bad commit cb17630
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 cb17630

Please sign in to comment.