mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-15 11:53:08 +02:00
49 lines
924 B
TypeScript
49 lines
924 B
TypeScript
|
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];
|
||
|
}
|