Skip to content

Commit

Permalink
added GET /comments/booking/:id
Browse files Browse the repository at this point in the history
  • Loading branch information
margoglvz committed Jan 3, 2025
1 parent eccd1dd commit 4bb2163
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions server/routes/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,14 @@ commentsRouter.get("/invoice/:id", async (req, res) => {
}
});

// GET /comments/booking/:id
// Returns all comments that much up that invoice ID
commentsRouter.get("/booking/:id", async (req, res) => {
try {
const {id} = req.params;
const data = await db.query("SELECT * FROM comments WHERE booking_id = $1", [id]);
res.status(200).json(keysToCamel(data));
} catch (err) {
res.status(500).send(err.message);
}
});

0 comments on commit 4bb2163

Please sign in to comment.