misskey/packages/backend/src/models/entities/ClipNote.ts

43 lines
807 B
TypeScript
Raw Normal View History

/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm';
import { id } from '../id.js';
2022-09-17 20:27:08 +02:00
import { Note } from './Note.js';
import { Clip } from './Clip.js';
@Entity()
@Index(['noteId', 'clipId'], { unique: true })
export class ClipNote {
@PrimaryColumn(id())
public id: string;
@Index()
@Column({
...id(),
2021-12-09 15:58:30 +01:00
comment: 'The note ID.',
})
public noteId: Note['id'];
@ManyToOne(type => Note, {
2021-12-09 15:58:30 +01:00
onDelete: 'CASCADE',
})
@JoinColumn()
public note: Note | null;
@Index()
@Column({
...id(),
2021-12-09 15:58:30 +01:00
comment: 'The clip ID.',
})
public clipId: Clip['id'];
@ManyToOne(type => Clip, {
2021-12-09 15:58:30 +01:00
onDelete: 'CASCADE',
})
@JoinColumn()
public clip: Clip | null;
}