misskey/packages/backend/src/models/AbuseReportNotificationReci...

101 lines
2.0 KiB
TypeScript
Raw Normal View History

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Column, Entity, Index, JoinColumn, ManyToOne, PrimaryColumn } from 'typeorm';
import { MiSystemWebhook } from '@/models/SystemWebhook.js';
import { MiUserProfile } from '@/models/UserProfile.js';
import { id } from './util/id.js';
import { MiUser } from './User.js';
/**
* .
*/
export type RecipientMethod = 'email' | 'webhook';
@Entity('abuse_report_notification_recipient')
export class MiAbuseReportNotificationRecipient {
@PrimaryColumn(id())
public id: string;
/**
* .
*/
@Index()
@Column('boolean', {
default: true,
})
public isActive: boolean;
/**
* .
*/
@Column('timestamp with time zone', {
default: () => 'CURRENT_TIMESTAMP',
})
public updatedAt: Date;
/**
* .
*/
@Column('varchar', {
length: 255,
})
public name: string;
/**
* .
*/
@Index()
@Column('varchar', {
length: 64,
})
public method: RecipientMethod;
/**
* ID.
*/
@Index()
@Column({
...id(),
nullable: true,
})
public userId: MiUser['id'] | null;
/**
* .
*/
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn({ name: 'userId', referencedColumnName: 'id', foreignKeyConstraintName: 'FK_abuse_report_notification_recipient_userId1' })
public user: MiUser | null;
/**
* .
*/
@ManyToOne(type => MiUserProfile, {})
@JoinColumn({ name: 'userId', referencedColumnName: 'userId', foreignKeyConstraintName: 'FK_abuse_report_notification_recipient_userId2' })
public userProfile: MiUserProfile | null;
/**
* WebhookId.
*/
@Index()
@Column({
...id(),
nullable: true,
})
public systemWebhookId: string | null;
/**
* Webhook.
*/
@ManyToOne(type => MiSystemWebhook, {
onDelete: 'CASCADE',
})
@JoinColumn()
public systemWebhook: MiSystemWebhook | null;
}