diff options
author | LachlanCourt <lachlan.m.court@gmail.com> | 2022-07-05 01:23:54 +1000 |
---|---|---|
committer | Erkin Alp Güney <erkinalp9035@gmail.com> | 2022-07-04 22:22:43 +0300 |
commit | d75eefe7cd8249ed7f39928c916cf46ccab72f0f (patch) | |
tree | d8bea6d21ffad8cecf48f38b5c8c90c40ae835dc /api/src/routes | |
parent | Ensure query fails if role with specified id does not exist (diff) | |
download | server-d75eefe7cd8249ed7f39928c916cf46ccab72f0f.tar.xz |
Format changed files
Diffstat (limited to 'api/src/routes')
-rw-r--r-- | api/src/routes/guilds/#guild_id/roles/#role_id/index.ts | 19 |
1 files changed, 6 insertions, 13 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 c9a4f662..2ad01682 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 @@ -1,21 +1,14 @@ import { Router, Request, Response } from "express"; -import { - Role, - Member, - GuildRoleUpdateEvent, - GuildRoleDeleteEvent, - emitEvent, - handleFile -} from "@fosscord/util"; +import { Role, Member, GuildRoleUpdateEvent, GuildRoleDeleteEvent, emitEvent, handleFile } from "@fosscord/util"; import { route } from "@fosscord/api"; import { HTTPError } from "lambert-server"; -import {RoleModifySchema} from '../' +import { RoleModifySchema } from "../"; 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); +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.findOneOrFail({ guild_id, id: role_id }); return res.json(role); }); @@ -48,7 +41,7 @@ router.patch("/", route({ body: "RoleModifySchema", permission: "MANAGE_ROLES" } const { role_id, guild_id } = req.params; const body = req.body as RoleModifySchema; - if (body.icon) body.icon = await handleFile(`/role-icons/${role_id}`, body.icon as string); + if (body.icon) body.icon = await handleFile(`/role-icons/${role_id}`, body.icon as string); const role = new Role({ ...body, |