We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0b27fb5 commit 8421354Copy full SHA for 8421354
src/api/routes/invites/index.ts
@@ -44,7 +44,7 @@ router.get(
44
relations: PublicInviteRelation,
45
});
46
47
- res.status(200).send(invite);
+ res.status(200).send(invite.toPublicJSON());
48
},
49
);
50
src/util/entities/Invite.ts
@@ -104,6 +104,12 @@ export class Invite extends BaseClassWithoutId {
104
if (this.max_uses !== 0 && this.uses >= this.max_uses) return true;
105
return false;
106
}
107
+ toPublicJSON() {
108
+ return {
109
+ ...this,
110
+ inviter: this.inviter.toPublicUser(),
111
+ };
112
+ }
113
114
static async joinGuild(user_id: string, code: string) {
115
const invite = await Invite.findOneOrFail({ where: { code } });
0 commit comments