diff options
author | LachlanCourt <lachlan.m.court@gmail.com> | 2022-07-05 01:08:12 +1000 |
---|---|---|
committer | Erkin Alp Güney <erkinalp9035@gmail.com> | 2022-07-04 22:22:43 +0300 |
commit | 582491cfe14879cd32496ea548dfbdfd034b3076 (patch) | |
tree | e9adc393964461ae2a507ff1ae8a90ab29559d30 /api/src/routes | |
parent | Add semicolon (diff) | |
download | server-582491cfe14879cd32496ea548dfbdfd034b3076.tar.xz |
Ensure query fails if role with specified id does not exist
Diffstat (limited to 'api/src/routes')
-rw-r--r-- | api/src/routes/guilds/#guild_id/roles/#role_id/index.ts | 2 |
1 files changed, 1 insertions, 1 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 79cf39cc..c9a4f662 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,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); }); |