summary refs log tree commit diff
path: root/src/util/entities/Role.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/entities/Role.ts')
-rw-r--r--src/util/entities/Role.ts51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/util/entities/Role.ts b/src/util/entities/Role.ts
new file mode 100644
index 00000000..4b721b5b
--- /dev/null
+++ b/src/util/entities/Role.ts
@@ -0,0 +1,51 @@
+import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
+
+import { BaseClass } from "./BaseClass";
+import { Guild } from "./Guild";
+
+@Entity("roles")
+export class Role extends BaseClass {
+	@Column({ nullable: true })
+	@RelationId((role: Role) => role.guild)
+	guild_id: string;
+
+	@JoinColumn({ name: "guild_id" })
+	@ManyToOne(() => Guild, {
+		onDelete: "CASCADE",
+	})
+	guild: Guild;
+
+	@Column()
+	color: number;
+
+	@Column()
+	hoist: boolean;
+
+	@Column()
+	managed: boolean;
+
+	@Column()
+	mentionable: boolean;
+
+	@Column()
+	name: string;
+
+	@Column()
+	permissions: string;
+
+	@Column()
+	position: number;
+
+	@Column({ nullable: true })
+	icon: string;
+
+	@Column({ nullable: true })
+	unicode_emoji: string;
+
+	@Column({ type: "simple-json", nullable: true })
+	tags?: {
+		bot_id?: string;
+		integration_id?: string;
+		premium_subscriber?: boolean;
+	};
+}