Merge pull request #1180 from DEVTomatoCake/fix/guild-create-response-schema
Trying to fix guild response schemas
This commit is contained in:
commit
f00a31540e
Binary file not shown.
Binary file not shown.
@ -1,17 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
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
|
by the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU Affero General Public License for more details.
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
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/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -77,8 +77,8 @@ router.patch(
|
|||||||
requestBody: "GuildUpdateSchema",
|
requestBody: "GuildUpdateSchema",
|
||||||
permission: "MANAGE_GUILD",
|
permission: "MANAGE_GUILD",
|
||||||
responses: {
|
responses: {
|
||||||
"200": {
|
200: {
|
||||||
body: "GuildUpdateSchema",
|
body: "GuildCreateResponse",
|
||||||
},
|
},
|
||||||
401: {
|
401: {
|
||||||
body: "APIErrorResponse",
|
body: "APIErrorResponse",
|
||||||
|
|||||||
@ -52,7 +52,7 @@ router.get(
|
|||||||
}),
|
}),
|
||||||
async (req: Request, res: Response) => {
|
async (req: Request, res: Response) => {
|
||||||
const { guild_id } = req.params;
|
const { guild_id } = req.params;
|
||||||
|
|
||||||
const guild = await Guild.findOneOrFail({
|
const guild = await Guild.findOneOrFail({
|
||||||
where: { id: guild_id },
|
where: { id: guild_id },
|
||||||
select: {
|
select: {
|
||||||
|
|||||||
@ -28,7 +28,6 @@ import {
|
|||||||
Role,
|
Role,
|
||||||
Emoji,
|
Emoji,
|
||||||
PublicMember,
|
PublicMember,
|
||||||
Guild,
|
|
||||||
Channel,
|
Channel,
|
||||||
PublicUser,
|
PublicUser,
|
||||||
User,
|
User,
|
||||||
@ -43,6 +42,7 @@ import {
|
|||||||
ReadyUserGuildSettingsEntries,
|
ReadyUserGuildSettingsEntries,
|
||||||
ReadyPrivateChannel,
|
ReadyPrivateChannel,
|
||||||
GuildOrUnavailable,
|
GuildOrUnavailable,
|
||||||
|
GuildCreateResponse,
|
||||||
} from "@spacebar/util";
|
} from "@spacebar/util";
|
||||||
|
|
||||||
export interface Event {
|
export interface Event {
|
||||||
@ -195,7 +195,7 @@ export interface GuildCreateEvent extends Event {
|
|||||||
|
|
||||||
export interface GuildUpdateEvent extends Event {
|
export interface GuildUpdateEvent extends Event {
|
||||||
event: "GUILD_UPDATE";
|
event: "GUILD_UPDATE";
|
||||||
data: Guild;
|
data: GuildCreateResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GuildDeleteEvent extends Event {
|
export interface GuildDeleteEvent extends Event {
|
||||||
|
|||||||
@ -1,17 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
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
|
by the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU Affero General Public License for more details.
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
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/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -26,7 +26,6 @@ export interface GuildCreateSchema {
|
|||||||
region?: string;
|
region?: string;
|
||||||
icon?: string | null;
|
icon?: string | null;
|
||||||
channels?: ChannelModifySchema[];
|
channels?: ChannelModifySchema[];
|
||||||
guild_template_code?: string;
|
|
||||||
system_channel_id?: string;
|
system_channel_id?: string;
|
||||||
rules_channel_id?: string;
|
rules_channel_id?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,26 +1,24 @@
|
|||||||
/*
|
/*
|
||||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
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
|
by the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU Affero General Public License for more details.
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
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/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { GuildCreateSchema } from "@spacebar/util";
|
import { GuildCreateSchema } from "@spacebar/util";
|
||||||
|
|
||||||
export interface GuildUpdateSchema
|
export interface GuildUpdateSchema extends Omit<GuildCreateSchema, "channels"> {
|
||||||
extends Omit<GuildCreateSchema, "channels" | "name"> {
|
|
||||||
name?: string;
|
|
||||||
banner?: string | null;
|
banner?: string | null;
|
||||||
splash?: string | null;
|
splash?: string | null;
|
||||||
description?: string;
|
description?: string;
|
||||||
|
|||||||
@ -1,21 +1,42 @@
|
|||||||
/*
|
/*
|
||||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
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
|
by the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU Affero General Public License for more details.
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
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/>.
|
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;
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,25 +1,26 @@
|
|||||||
/*
|
/*
|
||||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
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
|
by the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU Affero General Public License for more details.
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
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/>.
|
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 {
|
export interface MemberJoinGuildResponse {
|
||||||
guild: Guild;
|
guild: GuildCreateResponse;
|
||||||
emojis: Emoji[];
|
emojis: Emoji[];
|
||||||
roles: Role[];
|
roles: Role[];
|
||||||
stickers: Sticker[];
|
stickers: Sticker[];
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { GuildCreateResponse } from "@spacebar/util";
|
||||||
import { GeneralConfiguration, LimitsConfiguration } from "../../config";
|
import { GeneralConfiguration, LimitsConfiguration } from "../../config";
|
||||||
import { DmChannelDTO } from "../../dtos";
|
import { DmChannelDTO } from "../../dtos";
|
||||||
import {
|
import {
|
||||||
@ -89,7 +90,7 @@ export type APIEmojiArray = Emoji[];
|
|||||||
export type APIMemberArray = Member[];
|
export type APIMemberArray = Member[];
|
||||||
export type APIPublicMember = PublicMember;
|
export type APIPublicMember = PublicMember;
|
||||||
|
|
||||||
export interface APIGuildWithJoinedAt extends Guild {
|
export interface APIGuildWithJoinedAt extends GuildCreateResponse {
|
||||||
joined_at: string;
|
joined_at: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user