From 0fbe9131adb8ef12f11362679c026ea285ea2e80 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Wed, 1 Sep 2021 23:33:14 +0200 Subject: :sparkles: generate open api schema based on body and db entities --- api/src/schema/Emoji.ts | 5 ++--- api/src/schema/Guild.ts | 2 +- api/src/schema/Invite.ts | 18 +++++++++--------- api/src/schema/index.ts | 11 +++++++++++ 4 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 api/src/schema/index.ts (limited to 'api/src') diff --git a/api/src/schema/Emoji.ts b/api/src/schema/Emoji.ts index deaccf5c..0406919c 100644 --- a/api/src/schema/Emoji.ts +++ b/api/src/schema/Emoji.ts @@ -1,14 +1,13 @@ // https://discord.com/developers/docs/resources/emoji - export const EmojiCreateSchema = { name: String, //name of the emoji image: String, // image data the 128x128 emoji image uri - roles: Array //roles allowed to use this emoji + $roles: Array //roles allowed to use this emoji }; export interface EmojiCreateSchema { name: string; // name of the emoji image: string; // image data the 128x128 emoji image uri - roles: []; //roles allowed to use this emoji + roles?: string[]; //roles allowed to use this emoji } diff --git a/api/src/schema/Guild.ts b/api/src/schema/Guild.ts index 3e98fe76..0f9fd884 100644 --- a/api/src/schema/Guild.ts +++ b/api/src/schema/Guild.ts @@ -48,7 +48,7 @@ export interface GuildUpdateSchema extends Omit { banner?: string; splash?: string; description?: string; - features?: [string]; + features?: string[]; verification_level?: number; default_message_notifications?: number; system_channel_flags?: number; diff --git a/api/src/schema/Invite.ts b/api/src/schema/Invite.ts index a22449ba..da6192bc 100644 --- a/api/src/schema/Invite.ts +++ b/api/src/schema/Invite.ts @@ -10,13 +10,13 @@ export const InviteCreateSchema = { $target_user_type: Number }; export interface InviteCreateSchema { - target_user_id?: String; - target_type?: String; - validate?: String; //? wtf is this - max_age?: Number; - max_uses?: Number; - temporary?: Boolean; - unique?: Boolean; - target_user?: String; - target_user_type?: Number; + target_user_id?: string; + target_type?: string; + validate?: string; //? wtf is this + max_age?: number; + max_uses?: number; + temporary?: boolean; + unique?: boolean; + target_user?: string; + target_user_type?: number; } diff --git a/api/src/schema/index.ts b/api/src/schema/index.ts new file mode 100644 index 00000000..b5f38a2f --- /dev/null +++ b/api/src/schema/index.ts @@ -0,0 +1,11 @@ +export * from "./Ban"; +export * from "./Channel"; +export * from "./Emoji"; +export * from "./Guild"; +export * from "./Invite"; +export * from "./Member"; +export * from "./Message"; +export * from "./Roles"; +export * from "./Template"; +export * from "./User"; +export * from "./Widget"; -- cgit 1.5.1