From 879587d62b8606ab3d57e4a7b0c484f75b64cbda Mon Sep 17 00:00:00 2001 From: xnacly Date: Fri, 3 Sep 2021 21:29:17 +0200 Subject: moved Constants and Errorhandler from api to util --- api/src/routes/guilds/#guild_id/roles.ts | 2 +- api/src/routes/guilds/index.ts | 2 +- api/src/routes/guilds/templates/index.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'api/src/routes/guilds') diff --git a/api/src/routes/guilds/#guild_id/roles.ts b/api/src/routes/guilds/#guild_id/roles.ts index bdfc370e..6a318688 100644 --- a/api/src/routes/guilds/#guild_id/roles.ts +++ b/api/src/routes/guilds/#guild_id/roles.ts @@ -14,7 +14,7 @@ import { HTTPError } from "lambert-server"; import { check } from "../../../util/instanceOf"; import { RoleModifySchema, RolePositionUpdateSchema } from "../../../schema/Roles"; -import { DiscordApiErrors } from "../../../util/Constants"; +import { DiscordApiErrors } from "@fosscord/util"; import { In } from "typeorm"; const router: Router = Router(); diff --git a/api/src/routes/guilds/index.ts b/api/src/routes/guilds/index.ts index 7c0b7abc..e5830647 100644 --- a/api/src/routes/guilds/index.ts +++ b/api/src/routes/guilds/index.ts @@ -3,7 +3,7 @@ import { Role, Guild, Snowflake, Config, User, Member, Channel } from "@fosscord import { HTTPError } from "lambert-server"; import { check } from "./../../util/instanceOf"; import { GuildCreateSchema } from "../../schema/Guild"; -import { DiscordApiErrors } from "../../util/Constants"; +import { DiscordApiErrors } from "@fosscord/util"; const router: Router = Router(); diff --git a/api/src/routes/guilds/templates/index.ts b/api/src/routes/guilds/templates/index.ts index 3a619278..58201f65 100644 --- a/api/src/routes/guilds/templates/index.ts +++ b/api/src/routes/guilds/templates/index.ts @@ -4,7 +4,7 @@ import { Template, Guild, Role, Snowflake, Config, User, Member } from "@fosscor import { HTTPError } from "lambert-server"; import { GuildTemplateCreateSchema } from "../../../schema/Guild"; import { check } from "../../../util/instanceOf"; -import { DiscordApiErrors } from "../../../util/Constants"; +import { DiscordApiErrors } from "@fosscord/util"; router.get("/:code", async (req: Request, res: Response) => { const { code } = req.params; -- cgit 1.4.1 From 78f348ea0b3bf53bc7bfca8a234ecf09e296f56f Mon Sep 17 00:00:00 2001 From: xnacly Date: Fri, 3 Sep 2021 21:33:25 +0200 Subject: replace '@me' with req.user_id in guild join --- api/src/routes/guilds/#guild_id/members/#member_id/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'api/src/routes/guilds') diff --git a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts index 66c508a2..7e79caad 100644 --- a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts +++ b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts @@ -51,7 +51,8 @@ router.patch("/", check(MemberChangeSchema), async (req: Request, res: Response) }); router.put("/", async (req: Request, res: Response) => { - const { guild_id, member_id } = req.params; + let { guild_id, member_id } = req.params; + if (member_id === "@me") member_id = req.user_id; throw new HTTPError("Maintenance: Currently you can't add a member", 403); // TODO: only for oauth2 applications -- cgit 1.4.1