hippofish/packages/backend/src/models/entities/note-edit.ts

52 lines
838 B
TypeScript
Raw Normal View History

2023-04-30 18:29:50 +02:00
import {
Entity,
JoinColumn,
Column,
ManyToOne,
PrimaryColumn,
Index,
} from "typeorm";
import { Note } from "./note.js";
import { id } from "../id.js";
import { DriveFile } from "./drive-file.js";
@Entity()
export class NoteEdit {
@PrimaryColumn(id())
public id: string;
@Index()
@Column({
...id(),
comment: 'The ID of note.',
})
public noteId: Note["id"];
@ManyToOne(type => Note, {
onDelete: 'CASCADE',
})
@JoinColumn()
public note: Note | null;
@Column('text', {
nullable: true,
})
public text: string | null;
@Column('varchar', {
length: 512, nullable: true,
})
public cw: string | null;
@Column({
...id(),
array: true, default: '{}',
})
public fileIds: DriveFile["id"][];
@Column('timestamp with time zone', {
comment: 'The updated date of the Note.',
})
public updatedAt: Date;
}