diff options
author | LachlanCourt <lachlan.m.court@gmail.com> | 2022-07-05 01:03:35 +1000 |
---|---|---|
committer | Erkin Alp Güney <erkinalp9035@gmail.com> | 2022-07-04 22:22:43 +0300 |
commit | c7fa2238537d96d4ad3db7269af941933335cd19 (patch) | |
tree | c3c293d2035586c068901c24c8e06c4813b5b3cb /api | |
parent | Move role_id specific api routes to correct file (diff) | |
download | server-c7fa2238537d96d4ad3db7269af941933335cd19.tar.xz |
Simplify role query as per code review
Diffstat (limited to 'api')
-rw-r--r-- | api/src/routes/guilds/#guild_id/roles/#role_id/index.ts | 3 |
1 files changed, 1 insertions, 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); }); |