summaryrefslogtreecommitdiff
path: root/packages/backend/src/models/entities/muted-note.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2021-11-12 02:02:25 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2021-11-12 02:02:25 +0900
commit0e4a111f81cceed275d9bec2695f6e401fb654d8 (patch)
tree40874799472fa07416f17b50a398ac33b7771905 /packages/backend/src/models/entities/muted-note.ts
parentupdate deps (diff)
downloadmisskey-0e4a111f81cceed275d9bec2695f6e401fb654d8.tar.gz
misskey-0e4a111f81cceed275d9bec2695f6e401fb654d8.tar.bz2
misskey-0e4a111f81cceed275d9bec2695f6e401fb654d8.zip
refactoring
Resolve #7779
Diffstat (limited to 'packages/backend/src/models/entities/muted-note.ts')
-rw-r--r--packages/backend/src/models/entities/muted-note.ts48
1 files changed, 48 insertions, 0 deletions
diff --git a/packages/backend/src/models/entities/muted-note.ts b/packages/backend/src/models/entities/muted-note.ts
new file mode 100644
index 0000000000..521876688c
--- /dev/null
+++ b/packages/backend/src/models/entities/muted-note.ts
@@ -0,0 +1,48 @@
+import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm';
+import { Note } from './note';
+import { User } from './user';
+import { id } from '../id';
+import { mutedNoteReasons } from '../../types';
+
+@Entity()
+@Index(['noteId', 'userId'], { unique: true })
+export class MutedNote {
+ @PrimaryColumn(id())
+ public id: string;
+
+ @Index()
+ @Column({
+ ...id(),
+ comment: 'The note ID.'
+ })
+ public noteId: Note['id'];
+
+ @ManyToOne(type => Note, {
+ onDelete: 'CASCADE'
+ })
+ @JoinColumn()
+ public note: Note | null;
+
+ @Index()
+ @Column({
+ ...id(),
+ comment: 'The user ID.'
+ })
+ public userId: User['id'];
+
+ @ManyToOne(type => User, {
+ onDelete: 'CASCADE'
+ })
+ @JoinColumn()
+ public user: User | null;
+
+ /**
+ * ミュートされた理由。
+ */
+ @Index()
+ @Column('enum', {
+ enum: mutedNoteReasons,
+ comment: 'The reason of the MutedNote.'
+ })
+ public reason: typeof mutedNoteReasons[number];
+}