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 | d47c0d6a82ff900c9d9b9a37f726c7cff6fcec9b (patch) | |
tree | 2e9570e7bc36dba0f7b84c0c0a308c7041fcc455 /api/src/routes/guilds/#guild_id/roles/#role_id | |
parent | Ensure query fails if role with specified id does not exist (diff) | |
download | server-d47c0d6a82ff900c9d9b9a37f726c7cff6fcec9b.tar.xz |
Format changed files
Diffstat (limited to 'api/src/routes/guilds/#guild_id/roles/#role_id')
-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, |