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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
import { PublicUser, User } from "./User";
import { BaseClass } from "./BaseClass";
import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
import { Guild } from "./Guild";
@Entity("members")
export class Member extends BaseClass {
@RelationId((member: Member) => member.user)
user_id: string;
@JoinColumn({ name: "user_id" })
@ManyToOne(() => User, (user: User) => user.id)
user: User;
@RelationId((member: Member) => member.guild)
guild_id: string;
@JoinColumn({ name: "guild_id" })
@ManyToOne(() => Guild, (guild: Guild) => guild.id)
guild: Guild;
@Column()
nick?: string;
@Column("simple-array")
roles: string[];
@Column()
joined_at: Date;
@Column()
premium_since?: number;
@Column()
deaf: boolean;
@Column()
mute: boolean;
@Column()
pending: boolean;
@Column("simple-json")
settings: UserGuildSettings;
// TODO: update
@Column("simple-json")
read_state: Record<string, string | null>;
}
export interface UserGuildSettings {
channel_overrides: {
channel_id: string;
message_notifications: number;
mute_config: MuteConfig;
muted: boolean;
}[];
message_notifications: number;
mobile_push: boolean;
mute_config: MuteConfig;
muted: boolean;
suppress_everyone: boolean;
suppress_roles: boolean;
version: number;
}
export interface MuteConfig {
end_time: number;
selected_time_window: number;
}
// @ts-ignore
export interface PublicMember extends Omit<Member, "settings" | "id" | "read_state"> {
user: PublicUser;
}
export const PublicMemberProjection = {
id: true,
guild_id: true,
nick: true,
roles: true,
joined_at: true,
pending: true,
deaf: true,
mute: true,
premium_since: true,
};
|