Skip to content

Commit

Permalink
fix for path params destructure bug
Browse files Browse the repository at this point in the history
  • Loading branch information
cdleveille committed Jun 7, 2024
1 parent 3eaacfb commit 9e577dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/controllers/bag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const initBagRoutes = (app: Elysia) => {
});

/* Get bag by id */
app.get("/bag/:id", async ({ request, params: id }) => {
app.get("/bag/:id", async ({ request, params: { id } }) => {
assertIsRequestAuthorized(request);
const bag = await Bag.findOne({ id }, projection);
if (!bag) throw new NotFoundError("Bag not found");
Expand Down Expand Up @@ -88,7 +88,7 @@ export const initBagRoutes = (app: Elysia) => {
});

/* Delete bag (bearer auth secured) */
app.delete("/bag/delete/:id", async ({ request, params: id }) => {
app.delete("/bag/delete/:id", async ({ request, params: { id } }) => {
assertIsRequestAuthorized(request);
if (!id) throw new BadRequestError("Required path param missing: id");
const bag = await Bag.findOne({ id });
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/disc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const initDiscRoutes = (app: Elysia) => {
});

/* Get disc by id */
app.get("/disc/:id", async ({ params: id }) => {
app.get("/disc/:id", async ({ params: { id } }) => {
const disc = await Disc.findOne({ id }, projection);
if (!disc) throw new NotFoundError("Disc not found");
return disc;
Expand All @@ -33,7 +33,7 @@ export const initDiscRoutes = (app: Elysia) => {
});

/* Delete disc by id (bearer auth secured) */
app.delete("/disc/:id", async ({ request, params: id }) => {
app.delete("/disc/:id", async ({ request, params: { id } }) => {
assertIsRequestAuthorized(request);
const disc = await Disc.findOne({ id });
if (!disc) throw new NotFoundError("Disc not found");
Expand Down

0 comments on commit 9e577dc

Please sign in to comment.