summary refs log tree commit diff
path: root/api/src
diff options
context:
space:
mode:
Diffstat (limited to 'api/src')
-rw-r--r--api/src/routes/channels/#channel_id/invites.ts7
-rw-r--r--api/src/routes/guilds/#guild_id/invites.ts4
-rw-r--r--api/src/routes/invites/index.ts4
3 files changed, 6 insertions, 9 deletions
diff --git a/api/src/routes/channels/#channel_id/invites.ts b/api/src/routes/channels/#channel_id/invites.ts
index fcc8a1ad..fe22d3bc 100644
--- a/api/src/routes/channels/#channel_id/invites.ts
+++ b/api/src/routes/channels/#channel_id/invites.ts
@@ -1,12 +1,9 @@
 import { Router, Request, Response } from "express";
 import { HTTPError } from "lambert-server";
-
 import { check } from "../../../util/instanceOf";
 import { random } from "../../../util/RandomInviteID";
-
 import { InviteCreateSchema } from "../../../schema/Invite";
-
-import { getPermission, Channel, Invite, InviteCreateEvent, emitEvent, User, Guild } from "@fosscord/util";
+import { getPermission, Channel, Invite, InviteCreateEvent, emitEvent, User, Guild, PublicInviteRelation } from "@fosscord/util";
 import { isTextChannel } from "./messages";
 
 const router: Router = Router();
@@ -74,7 +71,7 @@ router.get("/", async (req: Request, res: Response) => {
 	const permission = await getPermission(user_id, guild_id);
 	permission.hasThrow("MANAGE_CHANNELS");
 
-	const invites = await Invite.find({ guild_id });
+	const invites = await Invite.find({ where: { guild_id }, relations: PublicInviteRelation });
 
 	res.status(200).send(invites);
 });
diff --git a/api/src/routes/guilds/#guild_id/invites.ts b/api/src/routes/guilds/#guild_id/invites.ts
index 1843b689..39a934ee 100644
--- a/api/src/routes/guilds/#guild_id/invites.ts
+++ b/api/src/routes/guilds/#guild_id/invites.ts
@@ -1,4 +1,4 @@
-import { getPermission, Invite } from "@fosscord/util";
+import { getPermission, Invite, PublicInviteRelation } from "@fosscord/util";
 import { Request, Response, Router } from "express";
 
 const router = Router();
@@ -9,7 +9,7 @@ router.get("/", async (req: Request, res: Response) => {
 	const permissions = await getPermission(req.user_id, guild_id);
 	permissions.hasThrow("MANAGE_GUILD");
 
-	const invites = await Invite.find({ guild_id });
+	const invites = await Invite.find({ where: { guild_id }, relations: PublicInviteRelation });
 
 	return res.json(invites);
 });
diff --git a/api/src/routes/invites/index.ts b/api/src/routes/invites/index.ts
index 23fa3aec..b8c24c1f 100644
--- a/api/src/routes/invites/index.ts
+++ b/api/src/routes/invites/index.ts
@@ -1,12 +1,12 @@
 import { Router, Request, Response } from "express";
-import { getPermission, Guild, Invite, Member } from "@fosscord/util";
+import { getPermission, Guild, Invite, Member, PublicInviteRelation } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
 const router: Router = Router();
 
 router.get("/:code", async (req: Request, res: Response) => {
 	const { code } = req.params;
 
-	const invite = await Invite.findOneOrFail({ code });
+	const invite = await Invite.findOneOrFail({ where: { code }, relations: PublicInviteRelation });
 
 	res.status(200).send(invite);
 });