summary refs log tree commit diff
path: root/util/src/entities/Ban.ts
blob: 2553e886975563a249c31776955bce91b4735332 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
import { BaseClass } from "./BaseClass";
import { Guild } from "./Guild";
import { User } from "./User";

@Entity("bans")
export class Ban extends BaseClass {
	@RelationId((ban: Ban) => ban.user)
	user_id: string;

	@JoinColumn({ name: "user_id" })
	@ManyToOne(() => User, (user: User) => user.id)
	user: User;

	@RelationId((ban: Ban) => ban.guild)
	guild_id: string;

	@JoinColumn({ name: "guild_id" })
	@ManyToOne(() => Guild, (guild: Guild) => guild.id)
	guild: Guild;

	@RelationId((ban: Ban) => ban.executor)
	executor_id: string;

	@JoinColumn({ name: "executor_id" })
	@ManyToOne(() => User, (user: User) => user.id)
	executor: User;

	@Column()
	ip: string;

	@Column()
	reason?: string;
}