mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-22 21:53:46 +00:00
Simplify role query as per code review
This commit is contained in:
1 parent
6a801eafbf
commit
c7fa223853
1 file changed
+1
-2
@@ -16,8 +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 roles = await Role.find({ guild_id: guild_id })
|
||||
const role = roles.find((r: {id: string}) => r.id === role_id);
|
||||
const role = await Role.find({ guild_id, id: role_id })
|
||||
return res.json(role);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user