From 5dc1479431bb90d91443c3b08b73890fc96b22bc Mon Sep 17 00:00:00 2001 From: LachlanCourt Date: Tue, 5 Jul 2022 01:03:35 +1000 Subject: Simplify role query as per code review --- api/src/routes/guilds/#guild_id/roles/#role_id/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/src/routes/guilds/#guild_id/roles/#role_id/index.ts b/api/src/routes/guilds/#guild_id/roles/#role_id/index.ts index 88c1219b..2c1a4c7e 100644 --- a/api/src/routes/guilds/#guild_id/roles/#role_id/index.ts +++ b/api/src/routes/guilds/#guild_id/roles/#role_id/index.ts @@ -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); }); -- cgit 1.4.1