summary refs log tree commit diff
path: root/util/src/entities
diff options
context:
space:
mode:
Diffstat (limited to 'util/src/entities')
-rw-r--r--util/src/entities/Channel.ts4
-rw-r--r--util/src/entities/Invite.ts2
-rw-r--r--util/src/entities/Member.ts8
-rw-r--r--util/src/entities/Message.ts1
4 files changed, 7 insertions, 8 deletions
diff --git a/util/src/entities/Channel.ts b/util/src/entities/Channel.ts
index 2a1e38a4..5ccb43ce 100644
--- a/util/src/entities/Channel.ts
+++ b/util/src/entities/Channel.ts
@@ -169,7 +169,7 @@ export class Channel extends BaseClass {
 		}

 

 		if (!opts?.skipNameChecks) {

-			const guild = await Guild.findOneOrFail({ id: channel.guild_id });

+			const guild = await Guild.findOneOrFail({ where: { id: channel.guild_id } });

 			if (!guild.features.includes("ALLOW_INVALID_CHANNEL_NAMES") && channel.name) {

 				for (let character of InvisibleCharacters)

 					if (channel.name.includes(character))

@@ -194,7 +194,7 @@ export class Channel extends BaseClass {
 			case ChannelType.GUILD_NEWS:

 			case ChannelType.GUILD_VOICE:

 				if (channel.parent_id && !opts?.skipExistsCheck) {

-					const exists = await Channel.findOneOrFail({ id: channel.parent_id });

+					const exists = await Channel.findOneOrFail({ where: { id: channel.parent_id } });

 					if (!exists) throw new HTTPError("Parent id channel doesn't exist", 400);

 					if (exists.guild_id !== channel.guild_id)

 						throw new HTTPError("The category channel needs to be in the guild");

diff --git a/util/src/entities/Invite.ts b/util/src/entities/Invite.ts
index 6ac64ddc..b672caf7 100644
--- a/util/src/entities/Invite.ts
+++ b/util/src/entities/Invite.ts
@@ -75,7 +75,7 @@ export class Invite extends BaseClassWithoutId {
 	vanity_url?: boolean;
 
 	static async joinGuild(user_id: string, code: string) {
-		const invite = await Invite.findOneOrFail({ code });
+		const invite = await Invite.findOneOrFail({ where: { code } });
 		if (invite.uses++ >= invite.max_uses && invite.max_uses !== 0) await Invite.delete({ code });
 		else await invite.save();
 
diff --git a/util/src/entities/Member.ts b/util/src/entities/Member.ts
index f6d99125..e7e97b7c 100644
--- a/util/src/entities/Member.ts
+++ b/util/src/entities/Member.ts
@@ -117,7 +117,7 @@ export class Member extends BaseClassWithoutId {
 	// read_state: ReadState;
 
 	static async IsInGuildOrFail(user_id: string, guild_id: string) {
-		if (await Member.count({ id: user_id, guild: { id: guild_id } })) return true;
+		if (await Member.count({ where: { id: user_id, guild: { id: guild_id } } })) return true;
 		throw new HTTPError("You are not member of this guild", 403);
 	}
 
@@ -183,7 +183,7 @@ export class Member extends BaseClassWithoutId {
 				relations: ["user", "roles"], // we don't want to load  the role objects just the ids
 				select: ["index"],
 			}),
-			await Role.findOneOrFail({ id: role_id, guild_id }),
+			await Role.findOneOrFail({ where: { id: role_id, guild_id } }),
 		]);
 		member.roles = member.roles.filter((x) => x.id == role_id);
 
@@ -233,7 +233,7 @@ export class Member extends BaseClassWithoutId {
 			throw DiscordApiErrors.USER_BANNED;
 		}
 		const { maxGuilds } = Config.get().limits.user;
-		const guild_count = await Member.count({ id: user_id });
+		const guild_count = await Member.count({ where: { id: user_id } });
 		if (guild_count >= maxGuilds) {
 			throw new HTTPError(`You are at the ${maxGuilds} server limit.`, 403);
 		}
@@ -245,7 +245,7 @@ export class Member extends BaseClassWithoutId {
 			relations: PublicGuildRelations,
 		});
 
-		if (await Member.count({ id: user.id, guild: { id: guild_id } }))
+		if (await Member.count({ where: { id: user.id, guild: { id: guild_id } } }))
 			throw new HTTPError("You are already a member of this guild", 400);
 
 		const member = {
diff --git a/util/src/entities/Message.ts b/util/src/entities/Message.ts
index e18cf691..ba3d4f2d 100644
--- a/util/src/entities/Message.ts
+++ b/util/src/entities/Message.ts
@@ -8,7 +8,6 @@ import {
 	Column,
 	CreateDateColumn,
 	Entity,
-	FindConditions,
 	Index,
 	JoinColumn,
 	JoinTable,