diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2023-06-11 00:51:03 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2023-06-11 00:51:03 +1000 |
commit | 6c603afc5428b1f9e855dc4b3947020a11a67a3e (patch) | |
tree | e389f1127375be163e0884983a98754c4a1f43d4 /src/util/entities/Member.ts | |
parent | Send user and roles id array in GET /guilds/:id/members/:id (diff) | |
download | server-6c603afc5428b1f9e855dc4b3947020a11a67a3e.tar.xz |
Fix docs for /users/:id/profile
Diffstat (limited to 'src/util/entities/Member.ts')
-rw-r--r-- | src/util/entities/Member.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/util/entities/Member.ts b/src/util/entities/Member.ts index 8c208202..8be6eae1 100644 --- a/src/util/entities/Member.ts +++ b/src/util/entities/Member.ts @@ -344,11 +344,7 @@ export class Member extends BaseClassWithoutId { relations: ["user", "roles"], take: 10, }) - ).map((member) => ({ - ...member.toPublicMember(), - user: member.user.toPublicUser(), - roles: member.roles.map((x) => x.id), - })); + ).map((member) => member.toPublicMember()); if ( await Member.count({ @@ -455,6 +451,10 @@ export class Member extends BaseClassWithoutId { PublicMemberProjection.forEach((x) => { member[x] = this[x]; }); + + if (member.roles) member.roles = member.roles.map((x: Role) => x.id); + if (member.user) member.user = member.user.toPublicUser(); + return member as PublicMember; } } |