summary refs log tree commit diff
path: root/src/api/util
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-12-19 21:06:12 +0100
committerRory& <root@rory.gay>2025-12-19 21:06:12 +0100
commit6162fbd5205f805b6f67fdf2f8ab9cce0c03aec2 (patch)
tree37a7a9d9ecd10307a05ee3aa50f5e18e335d0d7a /src/api/util
parentprettier: ignore schemaExclusions.json (diff)
downloadserver-ts-6162fbd5205f805b6f67fdf2f8ab9cce0c03aec2.tar.xz
Deprecation: Use object-based relations for typeorm
Diffstat (limited to 'src/api/util')
-rw-r--r--src/api/util/handlers/Message.ts13
-rw-r--r--src/api/util/handlers/Webhook.ts2
2 files changed, 12 insertions, 3 deletions
diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts

index 618f02f04..766abd13f 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts
@@ -61,7 +61,7 @@ const LINK_REGEX = /<?https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0- export async function handleMessage(opts: MessageOptions): Promise<Message> { const channel = await Channel.findOneOrFail({ where: { id: opts.channel_id }, - relations: ["recipients"], + relations: { recipients: true }, }); if (!channel || !opts.channel_id) throw new HTTPError("Channel not found", 404); @@ -242,7 +242,16 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> { where: { id: opts.message_reference.message_id, }, - relations: ["author", "webhook", "application", "mentions", "mention_roles", "mention_channels", "sticker_items", "attachments"], + relations: { + author: true, + webhook: true, + application: true, + mentions: true, + mention_roles: true, + mention_channels: true, + sticker_items: true, + attachments: true, + }, }); if (message.referenced_message.channel_id && message.referenced_message.channel_id !== opts.message_reference.channel_id) diff --git a/src/api/util/handlers/Webhook.ts b/src/api/util/handlers/Webhook.ts
index cd0f2f6ef..d4aceb89e 100644 --- a/src/api/util/handlers/Webhook.ts +++ b/src/api/util/handlers/Webhook.ts
@@ -14,7 +14,7 @@ export const executeWebhook = async (req: Request, res: Response) => { where: { id: webhook_id, }, - relations: ["channel", "guild", "application"], + relations: { channel: true, guild: true, application: true }, }); if (!webhook) {