Skip to content

Commit 8421354

Browse files
committed
fix invite API slightly
1 parent 0b27fb5 commit 8421354

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/api/routes/invites/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ router.get(
4444
relations: PublicInviteRelation,
4545
});
4646

47-
res.status(200).send(invite);
47+
res.status(200).send(invite.toPublicJSON());
4848
},
4949
);
5050

src/util/entities/Invite.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ export class Invite extends BaseClassWithoutId {
104104
if (this.max_uses !== 0 && this.uses >= this.max_uses) return true;
105105
return false;
106106
}
107+
toPublicJSON() {
108+
return {
109+
...this,
110+
inviter: this.inviter.toPublicUser(),
111+
};
112+
}
107113

108114
static async joinGuild(user_id: string, code: string) {
109115
const invite = await Invite.findOneOrFail({ where: { code } });

0 commit comments

Comments
 (0)