Skip to content

Commit

Permalink
Modified /catalog get to return data and amount of events
Browse files Browse the repository at this point in the history
Co-authored-by: Maithy Le <[email protected]>
  • Loading branch information
h0ethan04 and maithyy committed Feb 1, 2024
1 parent a743053 commit 317f0cf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion routes/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ catalogRouter.get('/', async (req, res) => {

const offset = (page - 1) * limit;
const allInfo = await db.query(`SELECT * from catalog LIMIT $1 OFFSET $2;`, [limit, offset]);
res.status(200).json(keysToCamel(allInfo));
const eventCount = await db.query(`SELECT COUNT(DISTINCT id) from catalog;`);
res.status(200).json(keysToCamel({ events: allInfo, count: eventCount }));
} catch (err) {
res.status(500).send(err.message);
}
Expand Down

0 comments on commit 317f0cf

Please sign in to comment.