mirror of
https://github.com/spacebarchat/server.git
synced 2026-07-28 16:19:25 +00:00
Remove APIPublicMember, APIMessage
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
},
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user