From 08e837bf5559e9680fc8cb99bd05b93f8eb2cac5 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Thu, 12 Aug 2021 20:09:35 +0200 Subject: :sparkles: api --- api/src/schema/Channel.ts | 62 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 api/src/schema/Channel.ts (limited to 'api/src/schema/Channel.ts') diff --git a/api/src/schema/Channel.ts b/api/src/schema/Channel.ts new file mode 100644 index 00000000..48c3a1d2 --- /dev/null +++ b/api/src/schema/Channel.ts @@ -0,0 +1,62 @@ +import { ChannelType } from "@fosscord/server-util"; +import { Length } from "../util/instanceOf"; + +export const ChannelModifySchema = { + name: new Length(String, 2, 100), + type: new Length(Number, 0, 13), + $topic: new Length(String, 0, 1024), + $bitrate: Number, + $user_limit: Number, + $rate_limit_per_user: new Length(Number, 0, 21600), + $position: Number, + $permission_overwrites: [ + { + id: String, + type: new Length(Number, 0, 1), // either 0 (role) or 1 (member) + allow: BigInt, + deny: BigInt + } + ], + $parent_id: String, + $nsfw: Boolean +}; + +export const DmChannelCreateSchema = { + $name: String, + recipients: new Length([String], 1, 10) +}; + +export interface DmChannelCreateSchema { + name?: string; + recipients: string[]; +} + +export interface ChannelModifySchema { + name: string; + type: number; + topic?: string; + bitrate?: number; + user_limit?: number; + rate_limit_per_user?: number; + position?: number; + permission_overwrites?: { + id: string; + type: number; + allow: bigint; + deny: bigint; + }[]; + parent_id?: string; + nsfw?: boolean; +} + +export const ChannelGuildPositionUpdateSchema = [ + { + id: String, + $position: Number + } +]; + +export type ChannelGuildPositionUpdateSchema = { + id: string; + position?: number; +}[]; -- cgit 1.5.1