summaryrefslogtreecommitdiff
path: root/packages/backend/src/models/MutedNote.ts
diff options
context:
space:
mode:
authorMar0xy <marie@kaifa.ch>2023-10-03 20:21:26 +0200
committerMar0xy <marie@kaifa.ch>2023-10-03 20:21:26 +0200
commitbf3d493d049f30a93aecd8c39fbf433dcfbe959b (patch)
tree7821580eb5161f8182e8f5070baa12e21f74aa75 /packages/backend/src/models/MutedNote.ts
parentmerge: upstream (diff)
downloadsharkey-bf3d493d049f30a93aecd8c39fbf433dcfbe959b.tar.gz
sharkey-bf3d493d049f30a93aecd8c39fbf433dcfbe959b.tar.bz2
sharkey-bf3d493d049f30a93aecd8c39fbf433dcfbe959b.zip
Revert "feat: improve tl performance"
Diffstat (limited to 'packages/backend/src/models/MutedNote.ts')
-rw-r--r--packages/backend/src/models/MutedNote.ts53
1 files changed, 53 insertions, 0 deletions
diff --git a/packages/backend/src/models/MutedNote.ts b/packages/backend/src/models/MutedNote.ts
new file mode 100644
index 0000000000..89a678a2a7
--- /dev/null
+++ b/packages/backend/src/models/MutedNote.ts
@@ -0,0 +1,53 @@
+/*
+ * SPDX-FileCopyrightText: syuilo and other misskey contributors
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm';
+import { mutedNoteReasons } from '@/types.js';
+import { id } from './util/id.js';
+import { MiNote } from './Note.js';
+import { MiUser } from './User.js';
+
+@Entity('muted_note')
+@Index(['noteId', 'userId'], { unique: true })
+export class MiMutedNote {
+ @PrimaryColumn(id())
+ public id: string;
+
+ @Index()
+ @Column({
+ ...id(),
+ comment: 'The note ID.',
+ })
+ public noteId: MiNote['id'];
+
+ @ManyToOne(type => MiNote, {
+ onDelete: 'CASCADE',
+ })
+ @JoinColumn()
+ public note: MiNote | null;
+
+ @Index()
+ @Column({
+ ...id(),
+ comment: 'The user ID.',
+ })
+ public userId: MiUser['id'];
+
+ @ManyToOne(type => MiUser, {
+ onDelete: 'CASCADE',
+ })
+ @JoinColumn()
+ public user: MiUser | null;
+
+ /**
+ * ミュートされた理由。
+ */
+ @Index()
+ @Column('enum', {
+ enum: mutedNoteReasons,
+ comment: 'The reason of the MutedNote.',
+ })
+ public reason: typeof mutedNoteReasons[number];
+}