2020-01-29 19:37:25 +00:00
|
|
|
import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm';
|
2021-08-19 09:33:41 +00:00
|
|
|
import { Note } from './note.js';
|
|
|
|
import { Clip } from './clip.js';
|
|
|
|
import { id } from '../id.js';
|
2020-01-29 19:37:25 +00:00
|
|
|
|
|
|
|
@Entity()
|
|
|
|
@Index(['noteId', 'clipId'], { unique: true })
|
|
|
|
export class ClipNote {
|
|
|
|
@PrimaryColumn(id())
|
|
|
|
public id: string;
|
2020-03-04 02:45:33 +00:00
|
|
|
|
2020-01-29 19:37:25 +00:00
|
|
|
@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 clip ID.'
|
|
|
|
})
|
|
|
|
public clipId: Clip['id'];
|
|
|
|
|
|
|
|
@ManyToOne(type => Clip, {
|
|
|
|
onDelete: 'CASCADE'
|
|
|
|
})
|
|
|
|
@JoinColumn()
|
|
|
|
public clip: Clip | null;
|
|
|
|
}
|