summary refs log tree commit diff
path: root/src/util/schemas
diff options
context:
space:
mode:
authorEmma [it/its]@Rory& <root@rory.gay>2023-12-11 01:12:54 +0100
committerEmma [it/its]@Rory& <root@rory.gay>2023-12-11 01:12:54 +0100
commit0a8ceb9e6349284e75545a01ffad608b020f78e2 (patch)
tree17a9163f963eddabf9168b0b630096b2f7535b64 /src/util/schemas
parentPrettier: use editorconfig (diff)
downloadserver-dev/emma-refactors.tar.xz
Actually run prettier dev/emma-refactors
Diffstat (limited to 'src/util/schemas')
-rw-r--r--src/util/schemas/GuildUpdateSchema.ts3
-rw-r--r--src/util/schemas/UserGuildSettingsSchema.ts3
-rw-r--r--src/util/schemas/Validator.ts9
-rw-r--r--src/util/schemas/WebAuthnSchema.ts4
-rw-r--r--src/util/schemas/responses/APIErrorOrCaptchaResponse.ts4
-rw-r--r--src/util/schemas/responses/GuildMessagesSearchResponse.ts8
-rw-r--r--src/util/schemas/responses/GuildVanityUrl.ts5
-rw-r--r--src/util/schemas/responses/UserProfileResponse.ts18
8 files changed, 10 insertions, 44 deletions
diff --git a/src/util/schemas/GuildUpdateSchema.ts b/src/util/schemas/GuildUpdateSchema.ts

index 19316380..4f33b888 100644 --- a/src/util/schemas/GuildUpdateSchema.ts +++ b/src/util/schemas/GuildUpdateSchema.ts
@@ -18,8 +18,7 @@ import { GuildCreateSchema } from "@spacebar/util"; -export interface GuildUpdateSchema - extends Omit<GuildCreateSchema, "channels" | "name"> { +export interface GuildUpdateSchema extends Omit<GuildCreateSchema, "channels" | "name"> { name?: string; banner?: string | null; splash?: string | null; diff --git a/src/util/schemas/UserGuildSettingsSchema.ts b/src/util/schemas/UserGuildSettingsSchema.ts
index 82edae9c..603dbb21 100644 --- a/src/util/schemas/UserGuildSettingsSchema.ts +++ b/src/util/schemas/UserGuildSettingsSchema.ts
@@ -19,8 +19,7 @@ import { ChannelOverride, UserGuildSettings } from "@spacebar/util"; // This sucks. I would use a DeepPartial, my own or typeorms, but they both generate inncorect schema -export interface UserGuildSettingsSchema - extends Partial<Omit<UserGuildSettings, "channel_overrides">> { +export interface UserGuildSettingsSchema extends Partial<Omit<UserGuildSettings, "channel_overrides">> { channel_overrides?: { [channel_id: string]: ChannelOverride; }; diff --git a/src/util/schemas/Validator.ts b/src/util/schemas/Validator.ts
index 1de511d3..cedc2e73 100644 --- a/src/util/schemas/Validator.ts +++ b/src/util/schemas/Validator.ts
@@ -21,14 +21,7 @@ import addFormats from "ajv-formats"; import fs from "fs"; import path from "path"; -const SchemaPath = path.join( - __dirname, - "..", - "..", - "..", - "assets", - "schemas.json", -); +const SchemaPath = path.join(__dirname, "..", "..", "..", "assets", "schemas.json"); const schemas = JSON.parse(fs.readFileSync(SchemaPath, { encoding: "utf8" })); export const ajv = new Ajv({ diff --git a/src/util/schemas/WebAuthnSchema.ts b/src/util/schemas/WebAuthnSchema.ts
index 3f5e0da7..ada20de1 100644 --- a/src/util/schemas/WebAuthnSchema.ts +++ b/src/util/schemas/WebAuthnSchema.ts
@@ -28,9 +28,7 @@ export interface CreateWebAuthnCredentialSchema { ticket: string; } -export type WebAuthnPostSchema = - | GenerateWebAuthnCredentialsSchema - | CreateWebAuthnCredentialSchema; +export type WebAuthnPostSchema = GenerateWebAuthnCredentialsSchema | CreateWebAuthnCredentialSchema; export interface WebAuthnTotpSchema { code: string; diff --git a/src/util/schemas/responses/APIErrorOrCaptchaResponse.ts b/src/util/schemas/responses/APIErrorOrCaptchaResponse.ts
index c9a0e5be..069a05e0 100644 --- a/src/util/schemas/responses/APIErrorOrCaptchaResponse.ts +++ b/src/util/schemas/responses/APIErrorOrCaptchaResponse.ts
@@ -1,6 +1,4 @@ import { APIErrorResponse } from "./APIErrorResponse"; import { CaptchaRequiredResponse } from "./CaptchaRequiredResponse"; -export type APIErrorOrCaptchaResponse = - | CaptchaRequiredResponse - | APIErrorResponse; +export type APIErrorOrCaptchaResponse = CaptchaRequiredResponse | APIErrorResponse; diff --git a/src/util/schemas/responses/GuildMessagesSearchResponse.ts b/src/util/schemas/responses/GuildMessagesSearchResponse.ts
index 0b6248b7..b8e9bcc4 100644 --- a/src/util/schemas/responses/GuildMessagesSearchResponse.ts +++ b/src/util/schemas/responses/GuildMessagesSearchResponse.ts
@@ -1,10 +1,4 @@ -import { - Attachment, - Embed, - MessageType, - PublicUser, - Role, -} from "../../entities"; +import { Attachment, Embed, MessageType, PublicUser, Role } from "../../entities"; export interface GuildMessagesSearchMessage { id: string; diff --git a/src/util/schemas/responses/GuildVanityUrl.ts b/src/util/schemas/responses/GuildVanityUrl.ts
index ff37bf4e..6d67a932 100644 --- a/src/util/schemas/responses/GuildVanityUrl.ts +++ b/src/util/schemas/responses/GuildVanityUrl.ts
@@ -7,10 +7,7 @@ export interface GuildVanityUrlNoInvite { code: null; } -export type GuildVanityUrlResponse = - | GuildVanityUrl - | GuildVanityUrl[] - | GuildVanityUrlNoInvite; +export type GuildVanityUrlResponse = GuildVanityUrl | GuildVanityUrl[] | GuildVanityUrlNoInvite; export interface GuildVanityUrlCreateResponse { code: string; diff --git a/src/util/schemas/responses/UserProfileResponse.ts b/src/util/schemas/responses/UserProfileResponse.ts
index eba7cbcc..0dc58629 100644 --- a/src/util/schemas/responses/UserProfileResponse.ts +++ b/src/util/schemas/responses/UserProfileResponse.ts
@@ -1,27 +1,15 @@ -import { - Member, - PublicConnectedAccount, - PublicMember, - PublicUser, - User, -} from "@spacebar/util"; +import { Member, PublicConnectedAccount, PublicMember, PublicUser, User } from "@spacebar/util"; export type MutualGuild = { id: string; nick?: string; }; -export type PublicMemberProfile = Pick< - Member, - "banner" | "bio" | "guild_id" -> & { +export type PublicMemberProfile = Pick<Member, "banner" | "bio" | "guild_id"> & { accent_color: null; // TODO }; -export type UserProfile = Pick< - User, - "bio" | "accent_color" | "banner" | "pronouns" | "theme_colors" ->; +export type UserProfile = Pick<User, "bio" | "accent_color" | "banner" | "pronouns" | "theme_colors">; export interface UserProfileResponse { user: PublicUser;