hippofish/packages/backend/src/models/ClipNote.ts

43 lines
829 B
TypeScript
Raw Normal View History

/*
2024-02-12 03:37:45 +01:00
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm';
import { id } from './util/id.js';
import { MiNote } from './Note.js';
import { MiClip } from './Clip.js';
@Entity('clip_note')
@Index(['noteId', 'clipId'], { unique: true })
export class MiClipNote {
@PrimaryColumn(id())
public id: string;
@Index()
@Column({
...id(),
2021-12-09 15:58:30 +01:00
comment: 'The note ID.',
})
public noteId: MiNote['id'];
@ManyToOne(type => MiNote, {
2021-12-09 15:58:30 +01:00
onDelete: 'CASCADE',
})
@JoinColumn()
public note: MiNote | null;
@Index()
@Column({
...id(),
2021-12-09 15:58:30 +01:00
comment: 'The clip ID.',
})
public clipId: MiClip['id'];
@ManyToOne(type => MiClip, {
2021-12-09 15:58:30 +01:00
onDelete: 'CASCADE',
})
@JoinColumn()
public clip: MiClip | null;
}