summaryrefslogtreecommitdiff
path: root/src/models/entities/blocking.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/models/entities/blocking.ts')
-rw-r--r--src/models/entities/blocking.ts42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/models/entities/blocking.ts b/src/models/entities/blocking.ts
new file mode 100644
index 0000000000..48487cb086
--- /dev/null
+++ b/src/models/entities/blocking.ts
@@ -0,0 +1,42 @@
+import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
+import { User } from './user';
+import { id } from '../id';
+
+@Entity()
+@Index(['blockerId', 'blockeeId'], { unique: true })
+export class Blocking {
+ @PrimaryColumn(id())
+ public id: string;
+
+ @Index()
+ @Column('timestamp with time zone', {
+ comment: 'The created date of the Blocking.'
+ })
+ public createdAt: Date;
+
+ @Index()
+ @Column({
+ ...id(),
+ comment: 'The blockee user ID.'
+ })
+ public blockeeId: User['id'];
+
+ @ManyToOne(type => User, {
+ onDelete: 'CASCADE'
+ })
+ @JoinColumn()
+ public blockee: User | null;
+
+ @Index()
+ @Column({
+ ...id(),
+ comment: 'The blocker user ID.'
+ })
+ public blockerId: User['id'];
+
+ @ManyToOne(type => User, {
+ onDelete: 'CASCADE'
+ })
+ @JoinColumn()
+ public blocker: User | null;
+}