1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-05 10:22:31 +01:00

Merge pull request #1180 from DEVTomatoCake/fix/guild-create-response-schema

Trying to fix guild response schemas
This commit is contained in:
Madeline 2024-08-22 14:00:37 +10:00 committed by GitHub
commit f00a31540e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 23107 additions and 4576 deletions

View File

@ -3991,6 +3991,138 @@
"description": "A container for useful snowflake-related methods.",
"type": "object"
},
"GuildCreateResponse": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"primary_category_id": {
"type": "string"
},
"large": {
"type": "boolean"
},
"max_members": {
"type": "integer"
},
"max_presences": {
"type": "integer"
},
"max_video_channel_users": {
"type": "integer"
},
"member_count": {
"type": "integer"
},
"presence_count": {
"type": "integer"
},
"template_id": {
"type": "string"
},
"mfa_level": {
"type": "integer"
},
"owner_id": {
"type": "string"
},
"premium_subscription_count": {
"type": "integer"
},
"premium_tier": {
"type": "integer"
},
"welcome_screen": {
"$ref": "#/components/schemas/GuildWelcomeScreen"
},
"widget_channel_id": {
"type": "string"
},
"widget_enabled": {
"type": "boolean"
},
"nsfw_level": {
"type": "integer"
},
"nsfw": {
"type": "boolean"
},
"parent": {
"type": "string"
},
"icon": {
"type": "string",
"nullable": true
},
"banner": {
"type": "string",
"nullable": true
},
"description": {
"type": "string"
},
"region": {
"type": "string"
},
"system_channel_id": {
"type": "string"
},
"rules_channel_id": {
"type": "string"
},
"afk_timeout": {
"type": "integer"
},
"explicit_content_filter": {
"type": "integer"
},
"splash": {
"type": "string",
"nullable": true
},
"features": {
"type": "array",
"items": {
"type": "string"
}
},
"verification_level": {
"type": "integer"
},
"default_message_notifications": {
"type": "integer"
},
"system_channel_flags": {
"type": "integer"
},
"public_updates_channel_id": {
"type": "string"
},
"afk_channel_id": {
"type": "string"
},
"preferred_locale": {
"type": "string"
},
"premium_progress_bar_enabled": {
"type": "boolean"
},
"discovery_splash": {
"type": "string"
}
},
"required": [
"id",
"name",
"nsfw",
"welcome_screen",
"widget_enabled"
]
},
"TenorGifResponse": {
"type": "object",
"properties": {
@ -4174,19 +4306,7 @@
"explicit_content_filter": {
"type": "integer"
},
"afk_channel_id": {
"type": "string"
},
"bans": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Ban"
}
},
"default_message_notifications": {
"type": "integer"
},
"discovery_splash": {
"splash": {
"type": "string"
},
"features": {
@ -4195,6 +4315,36 @@
"type": "string"
}
},
"verification_level": {
"type": "integer"
},
"default_message_notifications": {
"type": "integer"
},
"system_channel_flags": {
"type": "integer"
},
"public_updates_channel_id": {
"type": "string"
},
"afk_channel_id": {
"type": "string"
},
"preferred_locale": {
"type": "string"
},
"premium_progress_bar_enabled": {
"type": "boolean"
},
"discovery_splash": {
"type": "string"
},
"bans": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Ban"
}
},
"primary_category_id": {
"type": "string"
},
@ -4240,27 +4390,12 @@
"mfa_level": {
"type": "integer"
},
"preferred_locale": {
"type": "string"
},
"premium_subscription_count": {
"type": "integer"
},
"premium_tier": {
"type": "integer"
},
"public_updates_channel_id": {
"type": "string"
},
"splash": {
"type": "string"
},
"system_channel_flags": {
"type": "integer"
},
"verification_level": {
"type": "integer"
},
"welcome_screen": {
"$ref": "#/components/schemas/GuildWelcomeScreen"
},
@ -4276,9 +4411,6 @@
"permissions": {
"type": "integer"
},
"premium_progress_bar_enabled": {
"type": "boolean"
},
"channel_ordering": {
"type": "array",
"items": {
@ -5073,9 +5205,6 @@
"$ref": "#/components/schemas/ChannelModifySchema"
}
},
"guild_template_code": {
"type": "string"
},
"system_channel_id": {
"type": "string"
},
@ -5102,9 +5231,6 @@
"GuildUpdateSchema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"banner": {
"type": "string",
"nullable": true
@ -5152,6 +5278,10 @@
"discovery_splash": {
"type": "string"
},
"name": {
"maxLength": 100,
"type": "string"
},
"icon": {
"type": "string",
"nullable": true
@ -5159,9 +5289,6 @@
"region": {
"type": "string"
},
"guild_template_code": {
"type": "string"
},
"system_channel_id": {
"type": "string"
},
@ -7042,17 +7169,6 @@
"user"
]
},
"GuildCreateResponse": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
]
},
"GuildDiscoveryRequirementsResponse": {
"type": "object",
"properties": {
@ -7506,7 +7622,7 @@
"type": "object",
"properties": {
"guild": {
"$ref": "#/components/schemas/Guild"
"$ref": "#/components/schemas/GuildCreateResponse"
},
"emojis": {
"type": "array",
@ -8034,52 +8150,17 @@
"joined_at": {
"type": "string"
},
"afk_channel_id": {
"id": {
"type": "string"
},
"afk_channel": {
"$ref": "#/components/schemas/Channel"
},
"afk_timeout": {
"type": "integer"
},
"bans": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Ban"
}
},
"banner": {
"name": {
"type": "string"
},
"default_message_notifications": {
"type": "integer"
},
"description": {
"type": "string"
},
"discovery_splash": {
"type": "string"
},
"explicit_content_filter": {
"type": "integer"
},
"features": {
"type": "array",
"items": {
"type": "string"
},
"default": []
},
"primary_category_id": {
"type": "string"
},
"icon": {
"type": "string"
},
"large": {
"type": "boolean",
"default": false
"type": "boolean"
},
"max_members": {
"type": "integer"
@ -8096,175 +8177,105 @@
"presence_count": {
"type": "integer"
},
"members": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Member"
}
},
"roles": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Role"
}
},
"channels": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Channel"
}
},
"template_id": {
"type": "string"
},
"template": {
"$ref": "#/components/schemas/Template"
},
"emojis": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Emoji"
}
},
"stickers": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Sticker"
}
},
"invites": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Invite"
}
},
"voice_states": {
"type": "array",
"items": {
"$ref": "#/components/schemas/VoiceState"
}
},
"webhooks": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Webhook"
}
},
"mfa_level": {
"type": "integer"
},
"name": {
"type": "string"
},
"owner_id": {
"type": "string"
},
"owner": {
"$ref": "#/components/schemas/User"
},
"preferred_locale": {
"type": "string"
},
"premium_subscription_count": {
"type": "integer"
},
"premium_tier": {
"type": "integer"
},
"public_updates_channel_id": {
"type": "string"
},
"public_updates_channel": {
"$ref": "#/components/schemas/Channel"
},
"rules_channel_id": {
"type": "string"
},
"rules_channel": {
"type": "string"
},
"region": {
"type": "string"
},
"splash": {
"type": "string"
},
"system_channel_id": {
"type": "string"
},
"system_channel": {
"$ref": "#/components/schemas/Channel"
},
"system_channel_flags": {
"type": "integer"
},
"unavailable": {
"type": "boolean",
"default": false
},
"verification_level": {
"type": "integer"
},
"welcome_screen": {
"$ref": "#/components/schemas/GuildWelcomeScreen"
},
"widget_channel_id": {
"type": "string"
},
"widget_channel": {
"$ref": "#/components/schemas/Channel"
},
"widget_enabled": {
"type": "boolean",
"default": true
"type": "boolean"
},
"nsfw_level": {
"type": "integer"
},
"nsfw": {
"type": "boolean",
"default": false
"type": "boolean"
},
"parent": {
"type": "string"
},
"permissions": {
"icon": {
"type": "string",
"nullable": true
},
"banner": {
"type": "string",
"nullable": true
},
"description": {
"type": "string"
},
"region": {
"type": "string"
},
"system_channel_id": {
"type": "string"
},
"rules_channel_id": {
"type": "string"
},
"afk_timeout": {
"type": "integer"
},
"premium_progress_bar_enabled": {
"type": "boolean",
"default": false
"explicit_content_filter": {
"type": "integer"
},
"channel_ordering": {
"splash": {
"type": "string",
"nullable": true
},
"features": {
"type": "array",
"items": {
"type": "string"
}
},
"id": {
"verification_level": {
"type": "integer"
},
"default_message_notifications": {
"type": "integer"
},
"system_channel_flags": {
"type": "integer"
},
"public_updates_channel_id": {
"type": "string"
},
"afk_channel_id": {
"type": "string"
},
"preferred_locale": {
"type": "string"
},
"premium_progress_bar_enabled": {
"type": "boolean"
},
"discovery_splash": {
"type": "string"
}
},
"required": [
"bans",
"channel_ordering",
"channels",
"emojis",
"features",
"id",
"invites",
"joined_at",
"members",
"name",
"nsfw",
"premium_progress_bar_enabled",
"public_updates_channel_id",
"roles",
"stickers",
"template",
"unavailable",
"voice_states",
"webhooks",
"welcome_screen",
"widget_enabled"
]
@ -14074,7 +14085,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GuildUpdateSchema"
"$ref": "#/components/schemas/GuildCreateResponse"
}
}
}
@ -17494,16 +17505,6 @@
}
}
}
},
"500": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/APIErrorResponse"
}
}
}
}
},
"tags": [

File diff suppressed because it is too large Load Diff

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
@ -77,8 +77,8 @@ router.patch(
requestBody: "GuildUpdateSchema",
permission: "MANAGE_GUILD",
responses: {
"200": {
body: "GuildUpdateSchema",
200: {
body: "GuildCreateResponse",
},
401: {
body: "APIErrorResponse",

View File

@ -52,7 +52,7 @@ router.get(
}),
async (req: Request, res: Response) => {
const { guild_id } = req.params;
const guild = await Guild.findOneOrFail({
where: { id: guild_id },
select: {

View File

@ -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 {

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
@ -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;
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
import { GuildCreateSchema } from "@spacebar/util";
export interface GuildUpdateSchema
extends Omit<GuildCreateSchema, "channels" | "name"> {
name?: string;
export interface GuildUpdateSchema extends Omit<GuildCreateSchema, "channels"> {
banner?: string | null;
splash?: string | null;
description?: string;

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
export interface GuildCreateResponse {
import { GuildUpdateSchema, GuildWelcomeScreen } from "@spacebar/util";
export interface GuildCreateResponse extends Omit<GuildUpdateSchema, "name"> {
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;
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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[];

View File

@ -16,6 +16,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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;
}