summary refs log tree commit diff
path: root/util/src/entities/ReadState.ts
diff options
context:
space:
mode:
Diffstat (limited to 'util/src/entities/ReadState.ts')
-rw-r--r--util/src/entities/ReadState.ts35
1 files changed, 35 insertions, 0 deletions
diff --git a/util/src/entities/ReadState.ts b/util/src/entities/ReadState.ts
new file mode 100644
index 00000000..7c56b6c6
--- /dev/null
+++ b/util/src/entities/ReadState.ts
@@ -0,0 +1,35 @@
+import { Column, Entity, JoinColumn, ManyToOne } from "typeorm";
+import { BaseClass } from "./BaseClass";
+import { Channel } from "./Channel";
+import { Message } from "./Message";
+import { User } from "./User";
+
+@Entity("read_states")
+export class ReadState extends BaseClass {
+	@Column()
+	channel_id: string;
+
+	@JoinColumn({ name: "channel_id" })
+	@ManyToOne(() => Channel, (channel: Channel) => channel.id)
+	channel: Channel;
+
+	@Column()
+	user_id: string;
+
+	@JoinColumn({ name: "user_id" })
+	@ManyToOne(() => User, (user: User) => user.id)
+	user: User;
+
+	@JoinColumn({ name: "last_message_id" })
+	@ManyToOne(() => Message, (message: Message) => message.id)
+	last_message?: Message;
+
+	@Column()
+	last_pin_timestamp?: Date;
+
+	@Column()
+	mention_count: number;
+
+	@Column()
+	manual: boolean;
+}