blob: d8c6d69caa0029a8b2e50726b82f79565b5caa3e (
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, PrimaryColumn, RelationId } 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 {
@PrimaryColumn()
code: string;
@Column()
temporary: boolean;
@Column()
uses: number;
@Column()
max_uses: number;
@Column()
max_age: number;
@Column()
created_at: Date;
@Column()
expires_at: Date;
@RelationId((invite: Invite) => invite.guild)
guild_id: string;
@JoinColumn({ name: "guild_id" })
@ManyToOne(() => Guild, (guild: Guild) => guild.id)
guild: Guild;
@RelationId((invite: Invite) => invite.channel)
channel_id: string;
@JoinColumn({ name: "channel_id" })
@ManyToOne(() => Channel, (channel: Channel) => channel.id)
channel: Channel;
@RelationId((invite: Invite) => invite.inviter)
inviter_id: string;
@JoinColumn({ name: "inviter_id" })
@ManyToOne(() => User, (user: User) => user.id)
inviter: User;
@RelationId((invite: Invite) => invite.target_user)
target_user_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({ nullable: true })
target_user_type?: number;
}
|