1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-23 10:52:30 +01:00

Merge pull request #776 from MaddyUnderStars/fix/member_id

Fix compile errors in latest
This commit is contained in:
Madeline 2022-06-26 23:35:31 +10:00 committed by GitHub
commit 9c6d0a98c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,24 +63,29 @@ router.put("/", route({}), async (req: Request, res: Response) => {
}
var guild = await Guild.findOneOrFail({
where: { id: guild_id } });
where: { id: guild_id }
});
var emoji = await Emoji.find({
where: { guild_id: guild_id } });
where: { guild_id: guild_id }
});
var roles = await Role.find({
where: { guild_id: guild_id } });
where: { guild_id: guild_id }
});
var stickers = await Sticker.find({
where: { guild_id: guild_id } });
where: { guild_id: guild_id }
});
await Member.addToGuild(member_id, guild_id);
res.send({...guild, emojis: emoji, roles: roles, stickers: stickers});
res.send({ ...guild, emojis: emoji, roles: roles, stickers: stickers });
});
router.delete("/", route(), async (req: Request, res: Response) => {
router.delete("/", route({}), async (req: Request, res: Response) => {
const permission = await getPermission(req.user_id);
const rights = await getRights(req.user_id);
const { guild_id, member_id } = req.params;
if (member_id !== "@me" || member_id === req.user_id) {
// TODO: unless force-joined
rights.hasThrow("SELF_LEAVE_GROUPS");
@ -88,7 +93,6 @@ router.delete("/", route(), async (req: Request, res: Response) => {
rights.hasThrow("KICK_BAN_MEMBERS");
permission.hasThrow("KICK_MEMBERS");
}
const { guild_id, member_id } = req.params;
await Member.removeFromGuild(member_id, guild_id);
res.sendStatus(204);