From c9ff1774b435b5af72faa97386890b3cb659744c Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Sun, 29 Aug 2021 00:03:40 +0200 Subject: :sparkles: typeorm api rewrite done --- api/src/util/Channel.ts | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'api/src/util/Channel.ts') 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, + channel: Partial, 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"); } -- cgit 1.5.1