From 0f928e479cbd81b17710da5dad14a092f23cdf0d Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Fri, 24 Mar 2023 04:16:58 +1100 Subject: Work towards fixing openapi spec --- src/api/routes/gateway/bot.ts | 11 ----------- src/api/routes/gateway/index.ts | 4 ---- src/api/routes/users/#id/profile.ts | 9 --------- src/api/routes/users/#id/relationships.ts | 10 ---------- src/util/entities/User.ts | 2 +- src/util/schemas/GatewayBotResponse.ts | 10 ++++++++++ src/util/schemas/GatewayResponse.ts | 3 +++ src/util/schemas/UserProfileResponse.ts | 8 ++++++++ src/util/schemas/UserRelationsResponse.ts | 9 +++++++++ src/util/schemas/index.ts | 4 ++++ 10 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 src/util/schemas/GatewayBotResponse.ts create mode 100644 src/util/schemas/GatewayResponse.ts create mode 100644 src/util/schemas/UserProfileResponse.ts create mode 100644 src/util/schemas/UserRelationsResponse.ts (limited to 'src') diff --git a/src/api/routes/gateway/bot.ts b/src/api/routes/gateway/bot.ts index 070debe3..02049b19 100644 --- a/src/api/routes/gateway/bot.ts +++ b/src/api/routes/gateway/bot.ts @@ -22,17 +22,6 @@ import { route, RouteOptions } from "@fosscord/api"; const router = Router(); -export interface GatewayBotResponse { - url: string; - shards: number; - session_start_limit: { - total: number; - remaining: number; - reset_after: number; - max_concurrency: number; - }; -} - const options: RouteOptions = { test: { response: { diff --git a/src/api/routes/gateway/index.ts b/src/api/routes/gateway/index.ts index e6fcf5e3..f5ed4c1f 100644 --- a/src/api/routes/gateway/index.ts +++ b/src/api/routes/gateway/index.ts @@ -22,10 +22,6 @@ import { route, RouteOptions } from "@fosscord/api"; const router = Router(); -export interface GatewayResponse { - url: string; -} - const options: RouteOptions = { test: { response: { diff --git a/src/api/routes/users/#id/profile.ts b/src/api/routes/users/#id/profile.ts index dbf95a52..92b4a0fc 100644 --- a/src/api/routes/users/#id/profile.ts +++ b/src/api/routes/users/#id/profile.ts @@ -18,9 +18,7 @@ import { Router, Request, Response } from "express"; import { - PublicConnectedAccount, User, - UserPublic, Member, UserProfileModifySchema, handleFile, @@ -32,13 +30,6 @@ import { route } from "@fosscord/api"; const router: Router = Router(); -export interface UserProfileResponse { - user: UserPublic; - connected_accounts: PublicConnectedAccount; - premium_guild_since?: Date; - premium_since?: Date; -} - router.get( "/", route({ test: { response: { body: "UserProfileResponse" } } }), diff --git a/src/api/routes/users/#id/relationships.ts b/src/api/routes/users/#id/relationships.ts index e915e3ff..04a407b7 100644 --- a/src/api/routes/users/#id/relationships.ts +++ b/src/api/routes/users/#id/relationships.ts @@ -22,16 +22,6 @@ import { route } from "@fosscord/api"; const router: Router = Router(); -export interface UserRelationsResponse { - object: { - id?: string; - username?: string; - avatar?: string; - discriminator?: string; - public_flags?: number; - }; -} - router.get( "/", route({ test: { response: { body: "UserRelationsResponse" } } }), diff --git a/src/util/entities/User.ts b/src/util/entities/User.ts index f99a85e7..8dfb0254 100644 --- a/src/util/entities/User.ts +++ b/src/util/entities/User.ts @@ -111,7 +111,7 @@ export class User extends BaseClass { banner?: string; // hash of the user banner @Column({ nullable: true, type: "simple-array" }) - theme_colors?: number[]; // TODO: Separate `User` and `UserProfile` models + theme_colors?: [number, number]; // TODO: Separate `User` and `UserProfile` models @Column({ nullable: true }) pronouns?: string; diff --git a/src/util/schemas/GatewayBotResponse.ts b/src/util/schemas/GatewayBotResponse.ts new file mode 100644 index 00000000..30f1f57f --- /dev/null +++ b/src/util/schemas/GatewayBotResponse.ts @@ -0,0 +1,10 @@ +export interface GatewayBotResponse { + url: string; + shards: number; + session_start_limit: { + total: number; + remaining: number; + reset_after: number; + max_concurrency: number; + }; +} diff --git a/src/util/schemas/GatewayResponse.ts b/src/util/schemas/GatewayResponse.ts new file mode 100644 index 00000000..e909f7bd --- /dev/null +++ b/src/util/schemas/GatewayResponse.ts @@ -0,0 +1,3 @@ +export interface GatewayResponse { + url: string; +} diff --git a/src/util/schemas/UserProfileResponse.ts b/src/util/schemas/UserProfileResponse.ts new file mode 100644 index 00000000..467d787f --- /dev/null +++ b/src/util/schemas/UserProfileResponse.ts @@ -0,0 +1,8 @@ +import { PublicConnectedAccount, UserPublic } from ".."; + +export interface UserProfileResponse { + user: UserPublic; + connected_accounts: PublicConnectedAccount; + premium_guild_since?: Date; + premium_since?: Date; +} diff --git a/src/util/schemas/UserRelationsResponse.ts b/src/util/schemas/UserRelationsResponse.ts new file mode 100644 index 00000000..1ec15eca --- /dev/null +++ b/src/util/schemas/UserRelationsResponse.ts @@ -0,0 +1,9 @@ +export interface UserRelationsResponse { + object: { + id?: string; + username?: string; + avatar?: string; + discriminator?: string; + public_flags?: number; + }; +} diff --git a/src/util/schemas/index.ts b/src/util/schemas/index.ts index 44909a3a..150a2dea 100644 --- a/src/util/schemas/index.ts +++ b/src/util/schemas/index.ts @@ -76,3 +76,7 @@ export * from "./VoiceVideoSchema"; export * from "./WebAuthnSchema"; export * from "./WebhookCreateSchema"; export * from "./WidgetModifySchema"; +export * from "./UserRelationsResponse"; +export * from "./GatewayResponse"; +export * from "./GatewayBotResponse"; +export * from "./UserProfileResponse"; -- cgit 1.4.1