mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-18 00:54:43 -04:00
feat: move title and description to revision entity
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
20197d36df
commit
90df9a4e32
8 changed files with 73 additions and 29 deletions
|
@ -7,8 +7,6 @@ import {
|
|||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
JoinTable,
|
||||
ManyToMany,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
|
@ -21,7 +19,6 @@ import { NoteUserPermission } from '../permissions/note-user-permission.entity';
|
|||
import { Revision } from '../revisions/revision.entity';
|
||||
import { User } from '../users/user.entity';
|
||||
import { Alias } from './alias.entity';
|
||||
import { Tag } from './tag.entity';
|
||||
import { generatePublicId } from './utils';
|
||||
|
||||
@Entity()
|
||||
|
@ -74,22 +71,6 @@ export class Note {
|
|||
@OneToMany((_) => MediaUpload, (mediaUpload) => mediaUpload.note)
|
||||
mediaUploads: Promise<MediaUpload[]>;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: 'text',
|
||||
})
|
||||
description: string | null;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: 'text',
|
||||
})
|
||||
title: string | null;
|
||||
|
||||
@ManyToMany((_) => Tag, (tag) => tag.notes, { eager: true, cascade: true })
|
||||
@JoinTable()
|
||||
tags: Promise<Tag[]>;
|
||||
|
||||
@Column({
|
||||
default: 2,
|
||||
})
|
||||
|
@ -122,9 +103,6 @@ export class Note {
|
|||
newNote.revisions = Promise.resolve([]);
|
||||
newNote.historyEntries = Promise.resolve([]);
|
||||
newNote.mediaUploads = Promise.resolve([]);
|
||||
newNote.description = null;
|
||||
newNote.title = null;
|
||||
newNote.tags = Promise.resolve([]);
|
||||
newNote.version = 2;
|
||||
return newNote;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
import { Column, Entity, ManyToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
import { Note } from './note.entity';
|
||||
import { Revision } from '../revisions/revision.entity';
|
||||
|
||||
@Entity()
|
||||
export class Tag {
|
||||
|
@ -17,6 +17,6 @@ export class Tag {
|
|||
})
|
||||
name: string;
|
||||
|
||||
@ManyToMany((_) => Note, (note) => note.tags)
|
||||
notes: Promise<Note[]>;
|
||||
@ManyToMany((_) => Revision, (revision) => revision.tags)
|
||||
revisions: Promise<Revision[]>;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue