summary refs log tree commit diff
path: root/util/oldModels/Webhook.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-24 16:35:59 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-24 16:35:59 +0200
commit05d72ac3ac0c8d887942c783a2c93a1ad7a34d1b (patch)
tree3e861ba5c436e48658da913a55aabab37a868227 /util/oldModels/Webhook.ts
parent:white_check_mark: util unit tests (diff)
downloadserver-05d72ac3ac0c8d887942c783a2c93a1ad7a34d1b.tar.xz
:sparkles: util
Diffstat (limited to 'util/oldModels/Webhook.ts')
-rw-r--r--util/oldModels/Webhook.ts84
1 files changed, 0 insertions, 84 deletions
diff --git a/util/oldModels/Webhook.ts b/util/oldModels/Webhook.ts
deleted file mode 100644

index 7379e98f..00000000 --- a/util/oldModels/Webhook.ts +++ /dev/null
@@ -1,84 +0,0 @@ -import { Schema, Document, Types } from "mongoose"; -import { transpileModule } from "typescript"; -import db from "../util/Database"; -import { ChannelModel } from "./Channel"; -import { GuildModel } from "./Guild"; - -export interface Webhook {} - -export enum WebhookType { - Incoming = 1, - ChannelFollower = 2, -} - -export interface WebhookDocument extends Document, Webhook { - id: String; - type: number; - guild_id?: string; - channel_id: string; - name?: string; - avatar?: string; - token?: string; - application_id?: string; - user_id?: string; - source_guild_id: string; -} - -export const WebhookSchema = new Schema({ - id: { type: String, required: true }, - type: { type: Number, required: true }, - guild_id: String, - channel_id: String, - name: String, - avatar: String, - token: String, - application_id: String, - user_id: String, - source_guild_id: String, - source_channel_id: String, -}); - -WebhookSchema.virtual("source_guild", { - ref: GuildModel, - localField: "id", - foreignField: "source_guild_id", - justOne: true, - autopopulate: { - select: { - icon: true, - id: true, - name: true, - }, - }, -}); - -WebhookSchema.virtual("source_channel", { - ref: ChannelModel, - localField: "id", - foreignField: "source_channel_id", - justOne: true, - autopopulate: { - select: { - id: true, - name: true, - }, - }, -}); - -WebhookSchema.virtual("source_channel", { - ref: ChannelModel, - localField: "id", - foreignField: "source_channel_id", - justOne: true, - autopopulate: { - select: { - id: true, - name: true, - }, - }, -}); - -WebhookSchema.set("removeResponse", ["source_channel_id", "source_guild_id"]); - -// @ts-ignore -export const WebhookModel = db.model<WebhookDocument>("Webhook", WebhookSchema, "webhooks");