Skip to content

Commit

Permalink
implement applications/@me
Browse files Browse the repository at this point in the history
  • Loading branch information
Puyodead1 committed Dec 5, 2023
1 parent f202ffe commit 9f37441
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/api/routes/applications/#id/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ router.get(
},
}),
async (req: Request, res: Response) => {
if (req.params.id === "@me") req.params.id = req.user_id;

const app = await Application.findOneOrFail({
where: { id: req.params.id },
relations: ["owner", "bot"],
});
if (app.owner.id != req.user_id)
if (app.owner.id != req.user_id && req.params.id !== "@me")
throw DiscordApiErrors.ACTION_NOT_AUTHORIZED_ON_APPLICATION;

return res.json(app);
Expand Down

0 comments on commit 9f37441

Please sign in to comment.