Format changed files
This commit is contained in:
parent
582491cfe1
commit
d75eefe7cd
@ -1,21 +1,14 @@
|
|||||||
import { Router, Request, Response } from "express";
|
import { Router, Request, Response } from "express";
|
||||||
import {
|
import { Role, Member, GuildRoleUpdateEvent, GuildRoleDeleteEvent, emitEvent, handleFile } from "@fosscord/util";
|
||||||
Role,
|
|
||||||
Member,
|
|
||||||
GuildRoleUpdateEvent,
|
|
||||||
GuildRoleDeleteEvent,
|
|
||||||
emitEvent,
|
|
||||||
handleFile
|
|
||||||
} from "@fosscord/util";
|
|
||||||
import { route } from "@fosscord/api";
|
import { route } from "@fosscord/api";
|
||||||
import { HTTPError } from "lambert-server";
|
import { HTTPError } from "lambert-server";
|
||||||
import {RoleModifySchema} from '../'
|
import { RoleModifySchema } from "../";
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
router.get("/",route({}), async (req: Request, res: Response) => {
|
router.get("/", route({}), async (req: Request, res: Response) => {
|
||||||
const { guild_id, role_id } = req.params
|
const { guild_id, role_id } = req.params;
|
||||||
await Member.IsInGuildOrFail(req.user_id, guild_id);
|
await Member.IsInGuildOrFail(req.user_id, guild_id);
|
||||||
const role = await Role.findOneOrFail({ guild_id, id: role_id });
|
const role = await Role.findOneOrFail({ guild_id, id: role_id });
|
||||||
return res.json(role);
|
return res.json(role);
|
||||||
});
|
});
|
||||||
@ -48,7 +41,7 @@ router.patch("/", route({ body: "RoleModifySchema", permission: "MANAGE_ROLES" }
|
|||||||
const { role_id, guild_id } = req.params;
|
const { role_id, guild_id } = req.params;
|
||||||
const body = req.body as RoleModifySchema;
|
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({
|
const role = new Role({
|
||||||
...body,
|
...body,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user