summary refs log tree commit diff
path: root/util/src/entities/Invite.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-24 16:34:46 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-24 16:34:46 +0200
commitb86032a001b45d3f345820b84ba4489981116919 (patch)
treec583ad6608be9393e88ea85f4aeb3f747e72c1d3 /util/src/entities/Invite.ts
parentgenerate schema (diff)
downloadserver-b86032a001b45d3f345820b84ba4489981116919.tar.xz
:sparkles: typeorm entities
Diffstat (limited to 'util/src/entities/Invite.ts')
-rw-r--r--util/src/entities/Invite.ts60
1 files changed, 60 insertions, 0 deletions
diff --git a/util/src/entities/Invite.ts b/util/src/entities/Invite.ts
new file mode 100644
index 00000000..19f7206a
--- /dev/null
+++ b/util/src/entities/Invite.ts
@@ -0,0 +1,60 @@
+import { Column, Entity, JoinColumn, ManyToOne } from "typeorm";
+import { BaseClass } from "./BaseClass";
+import { Channel } from "./Channel";
+import { Guild } from "./Guild";
+import { User } from "./User";
+
+@Entity("invites")
+export class Invite extends BaseClass {
+	@Column()
+	code: string;
+
+	@Column()
+	temporary: boolean;
+
+	@Column()
+	uses: number;
+
+	@Column()
+	max_uses: number;
+
+	@Column()
+	max_age: number;
+
+	@Column()
+	created_at: Date;
+
+	@Column()
+	expires_at: Date;
+
+	@Column()
+	guild_id: string;
+
+	@JoinColumn({ name: "guild_id" })
+	@ManyToOne(() => Guild, (guild: Guild) => guild.id)
+	guild: Guild;
+
+	@Column()
+	channel_id: string;
+
+	@JoinColumn({ name: "channel_id" })
+	@ManyToOne(() => Channel, (channel: Channel) => channel.id)
+	channel: Channel;
+
+	@Column()
+	inviter_id: string;
+
+	@JoinColumn({ name: "inviter_id" })
+	@ManyToOne(() => User, (user: User) => user.id)
+	inviter: User;
+
+	@Column()
+	target_usser_id: string;
+
+	@JoinColumn({ name: "target_user_id" })
+	@ManyToOne(() => User, (user: User) => user.id)
+	target_user?: string; // could be used for "User specific invites" https://github.com/fosscord/fosscord/issues/62
+
+	@Column()
+	target_user_type?: number;
+}