misskey-awawa/packages/backend/src/models/entities/AntennaNote.ts

44 lines
800 B
TypeScript
Raw Normal View History

import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm';
import { id } from '../id.js';
2022-09-17 18:27:08 +00:00
import { Note } from './Note.js';
import { Antenna } from './Antenna.js';
@Entity()
@Index(['noteId', 'antennaId'], { unique: true })
export class AntennaNote {
@PrimaryColumn(id())
public id: string;
@Index()
@Column({
...id(),
2021-12-09 14:58:30 +00:00
comment: 'The note ID.',
})
public noteId: Note['id'];
@ManyToOne(type => Note, {
2021-12-09 14:58:30 +00:00
onDelete: 'CASCADE',
})
@JoinColumn()
public note: Note | null;
@Index()
@Column({
...id(),
2021-12-09 14:58:30 +00:00
comment: 'The antenna ID.',
})
public antennaId: Antenna['id'];
@ManyToOne(type => Antenna, {
2021-12-09 14:58:30 +00:00
onDelete: 'CASCADE',
})
@JoinColumn()
public antenna: Antenna | null;
@Index()
@Column('boolean', {
2021-12-09 14:58:30 +00:00
default: false,
})
public read: boolean;
}