diff --git a/assets/openapi.json b/assets/openapi.json
index 34fff09f..b13eba95 100644
--- a/assets/openapi.json
+++ b/assets/openapi.json
@@ -4834,12 +4834,6 @@
"$ref": "#/components/schemas/Invite"
}
},
- "APIMessageArray": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Message"
- }
- },
"APIWebhookArray": {
"type": "array",
"items": {
@@ -4918,91 +4912,6 @@
"$ref": "#/components/schemas/Member"
}
},
- "APIPublicMember": {
- "type": "object",
- "properties": {
- "id": {
- "type": "string"
- },
- "guild_id": {
- "type": "string"
- },
- "flags": {
- "type": "integer"
- },
- "banner": {
- "type": "string"
- },
- "nick": {
- "type": "string"
- },
- "joined_at": {
- "type": "string",
- "format": "date-time"
- },
- "pending": {
- "type": "boolean"
- },
- "deaf": {
- "type": "boolean"
- },
- "mute": {
- "type": "boolean"
- },
- "premium_since": {
- "type": "integer"
- },
- "avatar": {
- "type": "string"
- },
- "bio": {
- "type": "string"
- },
- "theme_colors": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- },
- "pronouns": {
- "type": "string"
- },
- "communication_disabled_until": {
- "anyOf": [
- {
- "type": "string",
- "format": "date-time"
- },
- {
- "type": "null"
- }
- ]
- },
- "user": {
- "$ref": "#/components/schemas/PublicUser"
- },
- "roles": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- },
- "required": [
- "banner",
- "bio",
- "communication_disabled_until",
- "deaf",
- "flags",
- "guild_id",
- "id",
- "joined_at",
- "mute",
- "pending",
- "roles",
- "user"
- ]
- },
"APIGuildWithJoinedAt": {
"type": "object",
"properties": {
@@ -13526,7 +13435,7 @@
"length": {
"type": "integer"
},
- "__@unscopables@749": {
+ "__@unscopables@750": {
"type": "object",
"additionalProperties": false,
"patternProperties": {
@@ -13652,17 +13561,17 @@
"with": {
"type": "boolean"
},
- "__@iterator@747": {
+ "__@iterator@748": {
"type": "boolean"
},
- "__@unscopables@749": {
+ "__@unscopables@750": {
"type": "boolean"
}
}
}
},
"required": [
- "__@unscopables@749",
+ "__@unscopables@750",
"length"
]
},
@@ -14980,7 +14889,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/Message"
+ "$ref": "#/components/schemas/PublicMessage"
}
}
}
@@ -15047,7 +14956,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/Message"
+ "$ref": "#/components/schemas/PublicMessage"
}
}
}
@@ -15349,14 +15258,7 @@
},
"responses": {
"200": {
- "description": "",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Message"
- }
- }
- }
+ "description": "No description available"
},
"400": {
"description": "",
@@ -21989,7 +21891,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/APIPublicMember"
+ "$ref": "#/components/schemas/PublicMember"
}
}
}
@@ -22053,7 +21955,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/APIPublicMember"
+ "$ref": "#/components/schemas/PublicMember"
}
}
}
@@ -24432,7 +24334,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/APIMessageArray"
+ "$ref": "#/components/schemas/PublicMessageArray"
}
}
}
@@ -25348,7 +25250,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/APIMessageArray"
+ "$ref": "#/components/schemas/PublicMessageArray"
}
}
}
@@ -25660,7 +25562,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/APIMessageArray"
+ "$ref": "#/components/schemas/PublicMessageArray"
}
}
}
@@ -26229,7 +26131,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/Message"
+ "$ref": "#/components/schemas/PublicMessage"
}
}
}
@@ -26299,7 +26201,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/Message"
+ "$ref": "#/components/schemas/PublicMessage"
}
}
}
@@ -26358,7 +26260,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/Message"
+ "$ref": "#/components/schemas/PublicMessage"
}
}
}
@@ -26467,7 +26369,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/Message"
+ "$ref": "#/components/schemas/PublicMessage"
}
}
}
@@ -26802,7 +26704,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/Message"
+ "$ref": "#/components/schemas/PublicMessage"
}
}
}
diff --git a/assets/schemas.json b/assets/schemas.json
index 06555dbf..9a21b5bf 100644
--- a/assets/schemas.json
+++ b/assets/schemas.json
@@ -5114,13 +5114,6 @@
},
"$schema": "http://json-schema.org/draft-07/schema#"
},
- "APIMessageArray": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/Message"
- },
- "$schema": "http://json-schema.org/draft-07/schema#"
- },
"APIWebhookArray": {
"type": "array",
"items": {
@@ -5219,93 +5212,6 @@
},
"$schema": "http://json-schema.org/draft-07/schema#"
},
- "APIPublicMember": {
- "additionalProperties": false,
- "type": "object",
- "properties": {
- "id": {
- "type": "string"
- },
- "guild_id": {
- "type": "string"
- },
- "flags": {
- "type": "integer"
- },
- "banner": {
- "type": "string"
- },
- "nick": {
- "type": "string"
- },
- "joined_at": {
- "type": "string",
- "format": "date-time"
- },
- "pending": {
- "type": "boolean"
- },
- "deaf": {
- "type": "boolean"
- },
- "mute": {
- "type": "boolean"
- },
- "premium_since": {
- "type": "integer"
- },
- "avatar": {
- "type": "string"
- },
- "bio": {
- "type": "string"
- },
- "theme_colors": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- },
- "pronouns": {
- "type": "string"
- },
- "communication_disabled_until": {
- "anyOf": [
- {
- "type": "string",
- "format": "date-time"
- },
- {
- "type": "null"
- }
- ]
- },
- "user": {
- "$ref": "#/definitions/PublicUser"
- },
- "roles": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- },
- "required": [
- "banner",
- "bio",
- "communication_disabled_until",
- "deaf",
- "flags",
- "guild_id",
- "id",
- "joined_at",
- "mute",
- "pending",
- "roles",
- "user"
- ],
- "$schema": "http://json-schema.org/draft-07/schema#"
- },
"APIGuildWithJoinedAt": {
"type": "object",
"properties": {
@@ -14462,7 +14368,7 @@
"length": {
"type": "integer"
},
- "__@unscopables@749": {
+ "__@unscopables@750": {
"type": "object",
"additionalProperties": false,
"patternProperties": {
@@ -14588,17 +14494,17 @@
"with": {
"type": "boolean"
},
- "__@iterator@747": {
+ "__@iterator@748": {
"type": "boolean"
},
- "__@unscopables@749": {
+ "__@unscopables@750": {
"type": "boolean"
}
}
}
},
"required": [
- "__@unscopables@749",
+ "__@unscopables@750",
"length"
]
},
diff --git a/src/api/routes/channels/#channel_id/greet.ts b/src/api/routes/channels/#channel_id/greet.ts
index c9c3c9b0..51ff3583 100644
--- a/src/api/routes/channels/#channel_id/greet.ts
+++ b/src/api/routes/channels/#channel_id/greet.ts
@@ -32,7 +32,7 @@ router.post(
permission: "SEND_MESSAGES",
responses: {
200: {
- body: "Message",
+ body: "PublicMessage",
},
404: {},
400: {
@@ -102,7 +102,7 @@ router.post(
channel.save(),
]);
- res.send(message);
+ res.json(publicMsg);
},
);
diff --git a/src/api/routes/channels/#channel_id/messages/#message_id/crosspost.ts b/src/api/routes/channels/#channel_id/messages/#message_id/crosspost.ts
index 0db480a6..7ee337ff 100644
--- a/src/api/routes/channels/#channel_id/messages/#message_id/crosspost.ts
+++ b/src/api/routes/channels/#channel_id/messages/#message_id/crosspost.ts
@@ -27,7 +27,7 @@ router.post(
permission: "MANAGE_MESSAGES",
responses: {
200: {
- body: "Message",
+ body: "PublicMessage",
},
},
}),
diff --git a/src/api/routes/channels/#channel_id/messages/#message_id/index.ts b/src/api/routes/channels/#channel_id/messages/#message_id/index.ts
index 8285dc04..a4d5a852 100644
--- a/src/api/routes/channels/#channel_id/messages/#message_id/index.ts
+++ b/src/api/routes/channels/#channel_id/messages/#message_id/index.ts
@@ -56,7 +56,7 @@ router.patch(
right: "SEND_MESSAGES",
responses: {
200: {
- body: "Message",
+ body: "PublicMessage",
},
400: {
body: "APIErrorResponse",
@@ -115,26 +115,7 @@ router.patch(
postHandleMessage(new_message).catch((e) => console.error("[Message] post-message handler failed", e));
- // TODO: a DTO?
- return res.json({
- ...new_message.toJSON(),
- id: new_message.id,
- type: new_message.type,
- channel_id: new_message.channel_id,
- member: new_message.member?.toPublicMember(),
- author: new_message.author?.toPublicUser(),
- attachments: new_message.attachments,
- embeds: new_message.embeds,
- mentions: new_message.embeds,
- mention_roles: new_message.mention_roles,
- mention_everyone: new_message.mention_everyone,
- pinned: new_message.pinned,
- timestamp: new_message.timestamp,
- edited_timestamp: new_message.edited_timestamp,
-
- // these are not in the Discord.com response
- mention_channels: new_message.mention_channels,
- });
+ return res.json(new_message.toJSON());
},
);
@@ -155,7 +136,7 @@ router.put(
right: "SEND_BACKDATED_EVENTS",
responses: {
200: {
- body: "Message",
+ body: "PublicMessage",
},
400: {
body: "APIErrorResponse",
@@ -252,7 +233,7 @@ router.get(
permission: "VIEW_CHANNEL",
responses: {
200: {
- body: "Message",
+ body: "PublicMessage",
},
400: {
body: "APIErrorResponse",
@@ -276,7 +257,7 @@ router.get(
if (message.author_id !== req.user_id) permissions.hasThrow("READ_MESSAGE_HISTORY");
- return res.json(message);
+ return res.json(message.toJSON());
},
);
diff --git a/src/api/routes/channels/#channel_id/messages/index.ts b/src/api/routes/channels/#channel_id/messages/index.ts
index 6a453f6f..83b5bd0c 100644
--- a/src/api/routes/channels/#channel_id/messages/index.ts
+++ b/src/api/routes/channels/#channel_id/messages/index.ts
@@ -77,7 +77,7 @@ router.get(
},
responses: {
200: {
- body: "APIMessageArray",
+ body: "PublicMessageArray",
},
400: {
body: "APIErrorResponse",
@@ -291,7 +291,7 @@ router.post(
right: "SEND_MESSAGES",
responses: {
200: {
- body: "Message",
+ body: "PublicMessage",
},
400: {
body: "APIErrorResponse",
diff --git a/src/api/routes/channels/#channel_id/messages/pins/index.ts b/src/api/routes/channels/#channel_id/messages/pins/index.ts
index 443112b9..50d533c3 100644
--- a/src/api/routes/channels/#channel_id/messages/pins/index.ts
+++ b/src/api/routes/channels/#channel_id/messages/pins/index.ts
@@ -165,7 +165,7 @@ router.get(
permission: ["READ_MESSAGE_HISTORY"],
responses: {
200: {
- body: "APIMessageArray",
+ body: "PublicMessageArray",
},
400: {
body: "APIErrorResponse",
diff --git a/src/api/routes/channels/#channel_id/pins.ts b/src/api/routes/channels/#channel_id/pins.ts
index 136ac34e..c7aa9984 100644
--- a/src/api/routes/channels/#channel_id/pins.ts
+++ b/src/api/routes/channels/#channel_id/pins.ts
@@ -166,7 +166,7 @@ router.get(
permission: ["READ_MESSAGE_HISTORY"],
responses: {
200: {
- body: "APIMessageArray",
+ body: "PublicMessageArray",
},
400: {
body: "APIErrorResponse",
diff --git a/src/api/routes/guilds/#guild_id/members/#member_id/index.ts b/src/api/routes/guilds/#guild_id/members/#member_id/index.ts
index bfe8bb2e..929ae752 100644
--- a/src/api/routes/guilds/#guild_id/members/#member_id/index.ts
+++ b/src/api/routes/guilds/#guild_id/members/#member_id/index.ts
@@ -29,7 +29,7 @@ router.get(
route({
responses: {
200: {
- body: "APIPublicMember",
+ body: "PublicMember",
},
403: {
body: "APIErrorResponse",
diff --git a/src/api/routes/guilds/#guild_id/members/#member_id/nick.ts b/src/api/routes/guilds/#guild_id/members/#member_id/nick.ts
index b8b6d364..4d48aa2d 100644
--- a/src/api/routes/guilds/#guild_id/members/#member_id/nick.ts
+++ b/src/api/routes/guilds/#guild_id/members/#member_id/nick.ts
@@ -29,7 +29,7 @@ router.patch(
requestBody: "MemberNickChangeSchema",
responses: {
200: {
- body: "APIPublicMember",
+ body: "PublicMember",
},
400: {
body: "APIErrorResponse",
diff --git a/src/api/routes/webhooks/#webhook_id/#webhook_token/index.ts b/src/api/routes/webhooks/#webhook_id/#webhook_token/index.ts
index 886236ea..902bde02 100644
--- a/src/api/routes/webhooks/#webhook_id/#webhook_token/index.ts
+++ b/src/api/routes/webhooks/#webhook_id/#webhook_token/index.ts
@@ -156,9 +156,7 @@ router.patch(
route({
requestBody: "WebhookUpdateSchema",
responses: {
- 200: {
- body: "Message",
- },
+ 200: {},
400: {
body: "APIErrorResponse",
},
diff --git a/src/schemas/responses/TypedResponses.ts b/src/schemas/responses/TypedResponses.ts
index e0413a72..afc147cf 100644
--- a/src/schemas/responses/TypedResponses.ts
+++ b/src/schemas/responses/TypedResponses.ts
@@ -20,8 +20,8 @@
import { GeneralConfiguration, LimitsConfiguration } from "../../util/config/types";
import { DmChannelDTO } from "../../util/dtos";
// TODO: remove entity imports
-import { Application, BackupCode, Categories, Channel, Guild, Invite, Member, Message, Template, Webhook } from "@spacebar/database";
-import { GuildCreateResponse, PrivateUser, PublicMember, PublicUser } from "@spacebar/schemas";
+import { Application, BackupCode, Categories, Channel, Guild, Invite, Member, Template, Webhook } from "@spacebar/database";
+import { GuildCreateResponse, PrivateUser, PublicUser } from "@spacebar/schemas";
// TODO: remove this entire file!
// removes internal properties from the guild class
@@ -41,13 +41,11 @@ export type ApplicationEntitlementsResponse = unknown[];
export type ApplicationSkusResponse = unknown[];
export type APIApplicationArray = Application[];
export type APIInviteArray = Invite[];
-export type APIMessageArray = Message[];
export type APIWebhookArray = Webhook[];
export type APIDiscoveryCategoryArray = Categories[];
export type APIGeneralConfiguration = GeneralConfiguration;
export type APIChannelArray = Channel[];
export type APIMemberArray = Member[];
-export type APIPublicMember = PublicMember;
export interface APIGuildWithJoinedAt extends GuildCreateResponse {
joined_at: string;
|