diff options
-rw-r--r-- | api/src/routes/users/@me/guilds/#guild_id/settings.ts (renamed from api/src/routes/users/@me/guilds/settings.ts) | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/api/src/routes/users/@me/guilds/settings.ts b/api/src/routes/users/@me/guilds/#guild_id/settings.ts index 03029fcc..1c14bc36 100644 --- a/api/src/routes/users/@me/guilds/settings.ts +++ b/api/src/routes/users/@me/guilds/#guild_id/settings.ts @@ -9,7 +9,7 @@ export interface UserGuildSettingsSchema extends Partial<UserGuildSettings> { } // GET doesn't exist on discord.com router.get("/", route({}), async (req: Request, res: Response) => { const user = await Member.findOneOrFail({ - where: { id: req.user_id }, + where: { id: req.user_id, guild_id: req.params.guild_id }, select: ["settings"] }); return res.json(user.settings); @@ -18,7 +18,7 @@ router.get("/", route({}), async (req: Request, res: Response) => { router.patch("/", route({ body: "UserSettingsSchema" }), async (req: Request, res: Response) => { const body = req.body as UserGuildSettings; - const user = await Member.findOneOrFail({ where: { id: req.user_id } }); + const user = await Member.findOneOrFail({ where: { id: req.user_id, guild_id: req.params.guild_id } }); user.settings = { ...user.settings, ...body }; await user.save(); |