mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-22 18:32:29 +01:00
fix my shit
This commit is contained in:
parent
e88f72c4f0
commit
9506d50782
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user