diff options
| author | Mar0xy <marie@kaifa.ch> | 2023-09-22 21:05:42 +0200 |
|---|---|---|
| committer | Mar0xy <marie@kaifa.ch> | 2023-09-22 21:05:42 +0200 |
| commit | feec3c302b893e28c4862fb44a7ad4455d30cf85 (patch) | |
| tree | 860d2a153171b8a65aa1d00cd856370e1aee1451 /packages/backend/src/models/NoteEdit.ts | |
| parent | merge: develop branch (diff) | |
| download | sharkey-feec3c302b893e28c4862fb44a7ad4455d30cf85.tar.gz sharkey-feec3c302b893e28c4862fb44a7ad4455d30cf85.tar.bz2 sharkey-feec3c302b893e28c4862fb44a7ad4455d30cf85.zip | |
upd: add backend for post editing
Diffstat (limited to 'packages/backend/src/models/NoteEdit.ts')
| -rw-r--r-- | packages/backend/src/models/NoteEdit.ts | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/packages/backend/src/models/NoteEdit.ts b/packages/backend/src/models/NoteEdit.ts new file mode 100644 index 0000000000..547b135e56 --- /dev/null +++ b/packages/backend/src/models/NoteEdit.ts @@ -0,0 +1,46 @@ +import { Entity, JoinColumn, Column, ManyToOne, PrimaryColumn, Index } from "typeorm"; +import { id } from './util/id.js'; +import { MiNote } from './Note.js'; +import type { MiDriveFile } from './DriveFile.js'; + +@Entity() +export class NoteEdit { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column({ + ...id(), + comment: "The ID of note.", + }) + public noteId: MiNote["id"]; + + @ManyToOne((type) => MiNote, { + onDelete: "CASCADE", + }) + @JoinColumn() + public note: MiNote | 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: MiDriveFile["id"][]; + + @Column("timestamp with time zone", { + comment: "The updated date of the Note.", + }) + public updatedAt: Date; +} |