summary refs log tree commit diff
path: root/util/src/entities/Template.ts
diff options
context:
space:
mode:
Diffstat (limited to 'util/src/entities/Template.ts')
-rw-r--r--util/src/entities/Template.ts33
1 files changed, 33 insertions, 0 deletions
diff --git a/util/src/entities/Template.ts b/util/src/entities/Template.ts
new file mode 100644
index 00000000..5c9a5120
--- /dev/null
+++ b/util/src/entities/Template.ts
@@ -0,0 +1,33 @@
+import { Column, Entity, JoinColumn, ManyToOne } from "typeorm";
+import { BaseClass } from "./BaseClass";
+import { Guild } from "./Guild";
+import { User } from "./User";
+
+@Entity("templates")
+export class Template extends BaseClass {
+	@Column()
+	code: string;
+
+	@Column()
+	name: string;
+
+	@Column()
+	description?: string;
+
+	@Column()
+	usage_count?: number;
+
+	@JoinColumn({ name: "creator_id" })
+	@ManyToOne(() => User, (user: User) => user.id)
+	creator: User;
+
+	@Column()
+	created_at: Date;
+
+	@Column()
+	updated_at: Date;
+
+	@JoinColumn({ name: "source_guild_id" })
+	@ManyToOne(() => Guild, (guild: Guild) => guild.id)
+	source_guild: Guild;
+}