summary refs log tree commit diff
path: root/api/src/util/Channel.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-29 00:03:40 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-29 00:03:40 +0200
commite99008a1a5fe6eb64821235bb56d34d620e08fe7 (patch)
tree8e3320d9a2f1cbe58d980458fc94f7b826a1c78e /api/src/util/Channel.ts
parent:construction: typeorm (diff)
downloadserver-e99008a1a5fe6eb64821235bb56d34d620e08fe7.tar.xz
:sparkles: typeorm api rewrite done
Diffstat (limited to 'api/src/util/Channel.ts')
-rw-r--r--api/src/util/Channel.ts17
1 files changed, 3 insertions, 14 deletions
diff --git a/api/src/util/Channel.ts b/api/src/util/Channel.ts
index f518aefd..bc9217ce 100644
--- a/api/src/util/Channel.ts
+++ b/api/src/util/Channel.ts
@@ -1,20 +1,9 @@
-import {
-	ChannelCreateEvent,
-	Channel,
-	ChannelType,
-	emitEvent,
-	getPermission,
-	Guild,
-	Snowflake,
-	TextChannel,
-	toObject,
-	VoiceChannel
-} from "@fosscord/util";
+import { ChannelCreateEvent, Channel, ChannelType, emitEvent, getPermission, Snowflake } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
 
 // TODO: DM channel
 export async function createChannel(
-	channel: Partial<TextChannel | VoiceChannel>,
+	channel: Partial<Channel>,
 	user_id: string = "0",
 	opts?: {
 		keepId?: boolean;
@@ -29,7 +18,7 @@ export async function createChannel(
 		case ChannelType.GUILD_TEXT:
 		case ChannelType.GUILD_VOICE:
 			if (channel.parent_id && !opts?.skipExistsCheck) {
-				const exists = await Channel.findOneOrFail({ id: channel.parent_id }, { guild_id: true });
+				const exists = await Channel.findOneOrFail({ 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");
 			}