diff --git a/assets/openapi.json b/assets/openapi.json index 2af0a2c7..2adbc67e 100644 Binary files a/assets/openapi.json and b/assets/openapi.json differ diff --git a/assets/schemas.json b/assets/schemas.json index 05a63902..e71365ee 100644 Binary files a/assets/schemas.json and b/assets/schemas.json differ diff --git a/src/api/routes/guilds/#guild_id/index.ts b/src/api/routes/guilds/#guild_id/index.ts index 839ec363..75d05c9b 100644 --- a/src/api/routes/guilds/#guild_id/index.ts +++ b/src/api/routes/guilds/#guild_id/index.ts @@ -1,17 +1,17 @@ /* Spacebar: A FOSS re-implementation and extension of the Discord.com backend. Copyright (C) 2023 Spacebar and Spacebar Contributors - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ @@ -77,8 +77,8 @@ router.patch( requestBody: "GuildUpdateSchema", permission: "MANAGE_GUILD", responses: { - "200": { - body: "GuildUpdateSchema", + 200: { + body: "GuildCreateResponse", }, 401: { body: "APIErrorResponse", diff --git a/src/util/interfaces/Event.ts b/src/util/interfaces/Event.ts index a31e2263..253a013c 100644 --- a/src/util/interfaces/Event.ts +++ b/src/util/interfaces/Event.ts @@ -28,7 +28,6 @@ import { Role, Emoji, PublicMember, - Guild, Channel, PublicUser, User, @@ -43,6 +42,7 @@ import { ReadyUserGuildSettingsEntries, ReadyPrivateChannel, GuildOrUnavailable, + GuildCreateResponse, } from "@spacebar/util"; export interface Event { @@ -195,7 +195,7 @@ export interface GuildCreateEvent extends Event { export interface GuildUpdateEvent extends Event { event: "GUILD_UPDATE"; - data: Guild; + data: GuildCreateResponse; } export interface GuildDeleteEvent extends Event { diff --git a/src/util/schemas/GuildCreateSchema.ts b/src/util/schemas/GuildCreateSchema.ts index f7138991..41e3b214 100644 --- a/src/util/schemas/GuildCreateSchema.ts +++ b/src/util/schemas/GuildCreateSchema.ts @@ -1,17 +1,17 @@ /* Spacebar: A FOSS re-implementation and extension of the Discord.com backend. Copyright (C) 2023 Spacebar and Spacebar Contributors - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ @@ -26,7 +26,6 @@ export interface GuildCreateSchema { region?: string; icon?: string | null; channels?: ChannelModifySchema[]; - guild_template_code?: string; system_channel_id?: string; rules_channel_id?: string; } diff --git a/src/util/schemas/GuildUpdateSchema.ts b/src/util/schemas/GuildUpdateSchema.ts index 19316380..938daa1f 100644 --- a/src/util/schemas/GuildUpdateSchema.ts +++ b/src/util/schemas/GuildUpdateSchema.ts @@ -1,26 +1,24 @@ /* Spacebar: A FOSS re-implementation and extension of the Discord.com backend. Copyright (C) 2023 Spacebar and Spacebar Contributors - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ import { GuildCreateSchema } from "@spacebar/util"; -export interface GuildUpdateSchema - extends Omit { - name?: string; +export interface GuildUpdateSchema extends Omit { banner?: string | null; splash?: string | null; description?: string; diff --git a/src/util/schemas/responses/GuildCreateResponse.ts b/src/util/schemas/responses/GuildCreateResponse.ts index 5b2bf25d..50f5f2fc 100644 --- a/src/util/schemas/responses/GuildCreateResponse.ts +++ b/src/util/schemas/responses/GuildCreateResponse.ts @@ -1,21 +1,42 @@ /* Spacebar: A FOSS re-implementation and extension of the Discord.com backend. Copyright (C) 2023 Spacebar and Spacebar Contributors - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -export interface GuildCreateResponse { +import { GuildUpdateSchema, GuildWelcomeScreen } from "@spacebar/util"; + +export interface GuildCreateResponse extends Omit { id: string; + name: string; + primary_category_id: string | undefined; + large: boolean | undefined; + max_members: number | undefined; + max_presences: number | undefined; + max_video_channel_users: number | undefined; + member_count: number | undefined; + presence_count: number | undefined; + template_id: string | undefined; + mfa_level: number | undefined; + owner_id: string | undefined; + premium_subscription_count: number | undefined; + premium_tier: number | undefined; + welcome_screen: GuildWelcomeScreen; + widget_channel_id: string | undefined; + widget_enabled: boolean; + nsfw_level: number | undefined; + nsfw: boolean; + parent: string | undefined; } diff --git a/src/util/schemas/responses/MemberJoinGuildResponse.ts b/src/util/schemas/responses/MemberJoinGuildResponse.ts index b5c290b9..67d2de01 100644 --- a/src/util/schemas/responses/MemberJoinGuildResponse.ts +++ b/src/util/schemas/responses/MemberJoinGuildResponse.ts @@ -1,25 +1,26 @@ /* Spacebar: A FOSS re-implementation and extension of the Discord.com backend. Copyright (C) 2023 Spacebar and Spacebar Contributors - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -import { Emoji, Guild, Role, Sticker } from "../../entities"; +import { GuildCreateResponse } from "@spacebar/util"; +import { Emoji, Role, Sticker } from "../../entities"; export interface MemberJoinGuildResponse { - guild: Guild; + guild: GuildCreateResponse; emojis: Emoji[]; roles: Role[]; stickers: Sticker[]; diff --git a/src/util/schemas/responses/TypedResponses.ts b/src/util/schemas/responses/TypedResponses.ts index 8214ff7b..3b864781 100644 --- a/src/util/schemas/responses/TypedResponses.ts +++ b/src/util/schemas/responses/TypedResponses.ts @@ -16,6 +16,7 @@ along with this program. If not, see . */ +import { GuildCreateResponse } from "@spacebar/util"; import { GeneralConfiguration, LimitsConfiguration } from "../../config"; import { DmChannelDTO } from "../../dtos"; import { @@ -89,7 +90,7 @@ export type APIEmojiArray = Emoji[]; export type APIMemberArray = Member[]; export type APIPublicMember = PublicMember; -export interface APIGuildWithJoinedAt extends Guild { +export interface APIGuildWithJoinedAt extends GuildCreateResponse { joined_at: string; }