summary refs log tree commit diff
path: root/src/util/entities
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-10-04 23:48:00 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-10-04 23:48:00 +1100
commit6bf4637a03c6d251cf43542788de7d3d02374077 (patch)
tree39d8fe2beebe8cb229b6e5a492bedff649ae234b /src/util/entities
parentfucking prettier (diff)
downloadserver-6bf4637a03c6d251cf43542788de7d3d02374077.tar.xz
fucking postgres
Diffstat (limited to 'src/util/entities')
-rw-r--r--src/util/entities/Channel.ts12
-rw-r--r--src/util/entities/Guild.ts16
2 files changed, 14 insertions, 14 deletions
diff --git a/src/util/entities/Channel.ts b/src/util/entities/Channel.ts
index 8efddc73..169eab3d 100644
--- a/src/util/entities/Channel.ts
+++ b/src/util/entities/Channel.ts
@@ -215,7 +215,7 @@ export class Channel extends BaseClass {
 			where: { id: channel.guild_id },
 			select: {
 				features: !opts?.skipNameChecks,
-				channelOrdering: true,
+				channel_ordering: true,
 				id: true,
 			},
 		});
@@ -472,27 +472,27 @@ export class Channel extends BaseClass {
 		if (!guild)
 			guild = await Guild.findOneOrFail({
 				where: { id: guild_id },
-				select: { channelOrdering: true },
+				select: { channel_ordering: true },
 			});
 
-		return guild.channelOrdering.findIndex((id) => channel_id == id);
+		return guild.channel_ordering.findIndex((id) => channel_id == id);
 	}
 
 	static async getOrderedChannels(guild_id: string, guild?: Guild) {
 		if (!guild)
 			guild = await Guild.findOneOrFail({
 				where: { id: guild_id },
-				select: { channelOrdering: true },
+				select: { channel_ordering: true },
 			});
 
 		const channels = await Promise.all(
-			guild.channelOrdering.map((id) =>
+			guild.channel_ordering.map((id) =>
 				Channel.findOneOrFail({ where: { id } }),
 			),
 		);
 
 		return channels.reduce((r, v) => {
-			v.position = (guild as Guild).channelOrdering.indexOf(v.id);
+			v.position = (guild as Guild).channel_ordering.indexOf(v.id);
 			r[v.position] = v;
 			return r;
 		}, [] as Array<Channel>);
diff --git a/src/util/entities/Guild.ts b/src/util/entities/Guild.ts
index cf28f4ae..fcd6b729 100644
--- a/src/util/entities/Guild.ts
+++ b/src/util/entities/Guild.ts
@@ -298,7 +298,7 @@ export class Guild extends BaseClass {
 	premium_progress_bar_enabled: boolean = false;
 
 	@Column({ select: false, type: "simple-array" })
-	channelOrdering: string[];
+	channel_ordering: string[];
 
 	static async createGuild(body: {
 		name?: string;
@@ -327,7 +327,7 @@ export class Guild extends BaseClass {
 				description: "",
 				welcome_channels: [],
 			},
-			channelOrdering: [],
+			channel_ordering: [],
 
 			afk_timeout: Config.get().defaults.guild.afkTimeout,
 			default_message_notifications:
@@ -430,20 +430,20 @@ export class Guild extends BaseClass {
 		if (!guild)
 			guild = await Guild.findOneOrFail({
 				where: { id: guild_id },
-				select: { channelOrdering: true },
+				select: { channel_ordering: true },
 			});
 
 		let position;
 		if (typeof insertPoint == "string")
-			position = guild.channelOrdering.indexOf(insertPoint) + 1;
+			position = guild.channel_ordering.indexOf(insertPoint) + 1;
 		else position = insertPoint;
 
-		guild.channelOrdering.remove(channel_id);
+		guild.channel_ordering.remove(channel_id);
 
-		guild.channelOrdering.splice(position, 0, channel_id);
+		guild.channel_ordering.splice(position, 0, channel_id);
 		await Guild.update(
 			{ id: guild_id },
-			{ channelOrdering: guild.channelOrdering },
+			{ channel_ordering: guild.channel_ordering },
 		);
 		return position;
 	}
@@ -452,7 +452,7 @@ export class Guild extends BaseClass {
 		return {
 			...this,
 			unavailable: this.unavailable == false ? undefined : true,
-			channelOrdering: undefined,
+			channel_ordering: undefined,
 		};
 	}
 }