Remove APIPublicMember, APIMessage

This commit is contained in:
Rory&
2026-07-15 12:28:39 +02:00
parent 2ec647c071
commit 50fa6cc6d8
12 changed files with 17 additions and 40 deletions
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -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);
},
);
@@ -27,7 +27,7 @@ router.post(
permission: "MANAGE_MESSAGES",
responses: {
200: {
body: "Message",
body: "PublicMessage",
},
},
}),
@@ -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());
},
);
@@ -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",
@@ -165,7 +165,7 @@ router.get(
permission: ["READ_MESSAGE_HISTORY"],
responses: {
200: {
body: "APIMessageArray",
body: "PublicMessageArray",
},
400: {
body: "APIErrorResponse",
+1 -1
View File
@@ -166,7 +166,7 @@ router.get(
permission: ["READ_MESSAGE_HISTORY"],
responses: {
200: {
body: "APIMessageArray",
body: "PublicMessageArray",
},
400: {
body: "APIErrorResponse",
@@ -29,7 +29,7 @@ router.get(
route({
responses: {
200: {
body: "APIPublicMember",
body: "PublicMember",
},
403: {
body: "APIErrorResponse",
@@ -29,7 +29,7 @@ router.patch(
requestBody: "MemberNickChangeSchema",
responses: {
200: {
body: "APIPublicMember",
body: "PublicMember",
},
400: {
body: "APIErrorResponse",
@@ -156,9 +156,7 @@ router.patch(
route({
requestBody: "WebhookUpdateSchema",
responses: {
200: {
body: "Message",
},
200: {},
400: {
body: "APIErrorResponse",
},
+2 -4
View File
@@ -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;