mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-23 10:53:01 +00:00
Ensure query fails if role with specified id does not exist
This commit is contained in:
1 parent
73416102a0
commit
078c87ae17
1 file changed
+1
-1
@@ -16,7 +16,7 @@ const router = Router();
|
||||
router.get("/",route({}), async (req: Request, res: Response) => {
|
||||
const { guild_id, role_id } = req.params
|
||||
await Member.IsInGuildOrFail(req.user_id, guild_id);
|
||||
const role = await Role.find({ guild_id, id: role_id });
|
||||
const role = await Role.findOneOrFail({ guild_id, id: role_id });
|
||||
return res.json(role);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user