Ensure query fails if role with specified id does not exist

This commit is contained in:
LachlanCourt 2022-07-05 01:08:12 +10:00 committed by Erkin Alp Güney
parent 99afcf0f3c
commit 582491cfe1

View File

@ -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);
});