/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
@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;
@Column({
...id(),
comment: 'The blockee user ID.',
public blockeeId: User['id'];
@ManyToOne(type => User, {
onDelete: 'CASCADE',
@JoinColumn()
public blockee: User | null;
comment: 'The blocker user ID.',
public blockerId: User['id'];
public blocker: User | null;
}