summary refs log tree commit diff
path: root/util/src/entities/Invite.ts
blob: 19f7206abbaf1092995690bba9d9768527172786 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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;
}