firefish/packages/backend/src/models/entities/scheduled-note-creation.ts

45 lines
724 B
TypeScript

import {
Entity,
JoinColumn,
Column,
ManyToOne,
PrimaryColumn,
Index,
} from "typeorm";
import { Note } from "./note.js";
import { id } from "../id.js";
import { User } from "./user.js";
@Entity()
export class ScheduledNoteCreation {
@PrimaryColumn(id())
public id: string;
@Index()
@Column({
...id(),
comment: "The ID of note scheduled.",
})
public noteId: Note["id"];
@Index()
@Column(id())
public userId: User["id"];
@Column("timestamp without time zone")
public scheduledAt: Date;
//#region Relations
@ManyToOne(() => Note, {
onDelete: "CASCADE",
})
@JoinColumn()
public note: Note;
@ManyToOne(() => User, {
onDelete: "CASCADE",
})
@JoinColumn()
public user: User;
//#endregion
}