summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-12-18 23:45:29 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-12-18 23:45:29 +1100
commit970e67fe6505015dc55f41e365e1ad2d2876d215 (patch)
tree3a2104d77e9786feaa8518ee0a096fcff7bde3b2 /src/util
parentWhoops (diff)
downloadserver-970e67fe6505015dc55f41e365e1ad2d2876d215.tar.xz
Refactor applications
Diffstat (limited to 'src/util')
-rw-r--r--src/util/entities/Application.ts1
-rw-r--r--src/util/schemas/ApplicationCreateSchema.ts4
-rw-r--r--src/util/schemas/ApplicationModifySchema.ts14
-rw-r--r--src/util/schemas/BotModifySchema.ts4
-rw-r--r--src/util/schemas/Validator.ts1
-rw-r--r--src/util/schemas/index.ts5
6 files changed, 28 insertions, 1 deletions
diff --git a/src/util/entities/Application.ts b/src/util/entities/Application.ts
index 28381579..861c5bdd 100644
--- a/src/util/entities/Application.ts
+++ b/src/util/entities/Application.ts
@@ -37,6 +37,7 @@ export class Application extends BaseClass {
 	@ManyToOne(() => User)
 	owner: User;
 	
+	// TODO: enum this? https://discord.com/developers/docs/resources/application#application-object-application-flags
 	@Column()
 	flags: number = 0;
 	
diff --git a/src/util/schemas/ApplicationCreateSchema.ts b/src/util/schemas/ApplicationCreateSchema.ts
new file mode 100644
index 00000000..6a021b46
--- /dev/null
+++ b/src/util/schemas/ApplicationCreateSchema.ts
@@ -0,0 +1,4 @@
+export interface ApplicationCreateSchema {
+	name: string;
+	team_id?: string | number;
+}
\ No newline at end of file
diff --git a/src/util/schemas/ApplicationModifySchema.ts b/src/util/schemas/ApplicationModifySchema.ts
new file mode 100644
index 00000000..ab23d57e
--- /dev/null
+++ b/src/util/schemas/ApplicationModifySchema.ts
@@ -0,0 +1,14 @@
+export interface ApplicationModifySchema {
+	description?: string;
+	icon?: string;
+	interactions_endpoint_url?: string;
+	max_participants?: number | null;
+	name?: string;
+	privacy_policy_url?: string;
+	role_connections_verification_url?: string;
+	tags?: string[];
+	terms_of_service_url?: string;
+	bot_public?: boolean;
+	bot_require_code_grant?: boolean;
+	flags?: number;
+}
\ No newline at end of file
diff --git a/src/util/schemas/BotModifySchema.ts b/src/util/schemas/BotModifySchema.ts
new file mode 100644
index 00000000..b801ab27
--- /dev/null
+++ b/src/util/schemas/BotModifySchema.ts
@@ -0,0 +1,4 @@
+export interface BotModifySchema {
+	avatar?: string;
+	username?: string;
+}
\ No newline at end of file
diff --git a/src/util/schemas/Validator.ts b/src/util/schemas/Validator.ts
index e85cdf7b..9b7f0eca 100644
--- a/src/util/schemas/Validator.ts
+++ b/src/util/schemas/Validator.ts
@@ -22,6 +22,7 @@ export const ajv = new Ajv({
 	messages: true,
 	strict: true,
 	strictRequired: true,
+	allowUnionTypes: true,
 });
 
 addFormats(ajv);
diff --git a/src/util/schemas/index.ts b/src/util/schemas/index.ts
index 780022c6..58565496 100644
--- a/src/util/schemas/index.ts
+++ b/src/util/schemas/index.ts
@@ -45,4 +45,7 @@ export * from "./UserGuildSettingsSchema";
 export * from "./GatewayPayloadSchema";
 export * from "./RolePositionUpdateSchema";
 export * from "./ChannelReorderSchema";
-export * from "./UserSettingsSchema";
\ No newline at end of file
+export * from "./UserSettingsSchema";
+export * from "./BotModifySchema";
+export * from "./ApplicationModifySchema";
+export * from "./ApplicationCreateSchema";
\ No newline at end of file