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(),
|
2023-05-29 18:31:02 +02:00
|
|
|
comment: "The ID of note.",
|
2023-04-30 18:29:50 +02:00
|
|
|
})
|
|
|
|
public noteId: Note["id"];
|
|
|
|
|
2023-05-29 18:31:02 +02:00
|
|
|
@ManyToOne((type) => Note, {
|
|
|
|
onDelete: "CASCADE",
|
2023-04-30 18:29:50 +02:00
|
|
|
})
|
|
|
|
@JoinColumn()
|
|
|
|
public note: Note | null;
|
|
|
|
|
2023-05-29 18:31:02 +02:00
|
|
|
@Column("text", {
|
2023-04-30 18:29:50 +02:00
|
|
|
nullable: true,
|
|
|
|
})
|
|
|
|
public text: string | null;
|
|
|
|
|
2023-05-29 18:31:02 +02:00
|
|
|
@Column("varchar", {
|
|
|
|
length: 512,
|
|
|
|
nullable: true,
|
2023-04-30 18:29:50 +02:00
|
|
|
})
|
|
|
|
public cw: string | null;
|
|
|
|
|
|
|
|
@Column({
|
|
|
|
...id(),
|
2023-05-29 18:31:02 +02:00
|
|
|
array: true,
|
|
|
|
default: "{}",
|
2023-04-30 18:29:50 +02:00
|
|
|
})
|
|
|
|
public fileIds: DriveFile["id"][];
|
|
|
|
|
2023-05-29 18:31:02 +02:00
|
|
|
@Column("timestamp with time zone", {
|
|
|
|
comment: "The updated date of the Note.",
|
2023-04-30 18:29:50 +02:00
|
|
|
})
|
|
|
|
public updatedAt: Date;
|
|
|
|
}
|