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

Forgot to send roles in guild_member

This commit is contained in:
Madeline 2022-07-16 22:27:03 +10:00
parent ac0e03024b
commit 2e45d6aa10
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47

View File

@ -47,12 +47,9 @@ router.get("/", route({ test: { response: { body: "UserProfileResponse" } } }),
? await Member.findOneOrFail({ id: req.params.id, guild_id: guild_id }, { relations: ["roles"] }) ? await Member.findOneOrFail({ id: req.params.id, guild_id: guild_id }, { relations: ["roles"] })
: undefined; : undefined;
res.json({ // TODO: make proper DTO's in util?
connected_accounts: user.connected_accounts,
premium_guild_since: premium_guild_since, // TODO const userDto = {
premium_since: user.premium_since, // TODO
mutual_guilds: mutual_guilds, // TODO {id: "", nick: null} when ?with_mutual_guilds=true
user: {
username: user.username, username: user.username,
discriminator: user.discriminator, discriminator: user.discriminator,
id: user.id, id: user.id,
@ -62,8 +59,9 @@ router.get("/", route({ test: { response: { body: "UserProfileResponse" } } }),
banner: user.banner, banner: user.banner,
bio: req.user_bot ? null : user.bio, bio: req.user_bot ? null : user.bio,
bot: user.bot bot: user.bot
}, };
guild_member: guild_member ? {
const guildMemberDto = guild_member ? {
avatar: user.avatar, // TODO avatar: user.avatar, // TODO
banner: user.banner, // TODO banner: user.banner, // TODO
bio: req.user_bot ? null : user.bio, // TODO bio: req.user_bot ? null : user.bio, // TODO
@ -76,7 +74,17 @@ router.get("/", route({ test: { response: { body: "UserProfileResponse" } } }),
mute: guild_member.mute, mute: guild_member.mute,
nick: guild_member.nick, nick: guild_member.nick,
premium_since: guild_member.premium_since, premium_since: guild_member.premium_since,
} : undefined, roles: guild_member.roles.map(x => x.id),
user:
} : undefined;
res.json({
connected_accounts: user.connected_accounts,
premium_guild_since: premium_guild_since, // TODO
premium_since: user.premium_since, // TODO
mutual_guilds: mutual_guilds, // TODO {id: "", nick: null} when ?with_mutual_guilds=true
user: userDto,
guild_member: guildMemberDto,
}); });
}); });