mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-21 02:35:23 -04:00
History: Add HistoryEntry
With this the backend now can hold a history entry. Also included in this commit are some minor changes to tests and services so they can still work. Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
6bce4c241b
commit
b76fa91a3c
7 changed files with 72 additions and 2 deletions
|
@ -20,6 +20,7 @@ import { Revision } from '../revisions/revision.entity';
|
|||
import { User } from '../users/user.entity';
|
||||
import { AuthorColor } from './author-color.entity';
|
||||
import { Tag } from './tag.entity';
|
||||
import { HistoryEntry } from '../history/history-entry.entity';
|
||||
|
||||
@Entity()
|
||||
export class Note {
|
||||
|
@ -53,6 +54,8 @@ export class Note {
|
|||
revisions: Promise<Revision[]>;
|
||||
@OneToMany((_) => AuthorColor, (authorColor) => authorColor.note)
|
||||
authorColors: AuthorColor[];
|
||||
@OneToMany((_) => HistoryEntry, (historyEntry) => historyEntry.user)
|
||||
historyEntries: HistoryEntry[];
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
|
|
|
@ -21,6 +21,7 @@ import {
|
|||
import { NoteDto } from './note.dto';
|
||||
import { Note } from './note.entity';
|
||||
import { Tag } from './tag.entity';
|
||||
import { HistoryEntry } from '../history/history-entry.entity';
|
||||
|
||||
@Injectable()
|
||||
export class NotesService {
|
||||
|
@ -46,6 +47,7 @@ export class NotesService {
|
|||
description: 'Very descriptive text.',
|
||||
userPermissions: [],
|
||||
groupPermissions: [],
|
||||
historyEntries: [],
|
||||
tags: [],
|
||||
revisions: Promise.resolve([]),
|
||||
authorColors: [],
|
||||
|
@ -69,6 +71,7 @@ export class NotesService {
|
|||
newNote.alias = alias;
|
||||
}
|
||||
if (owner) {
|
||||
newNote.historyEntries = [HistoryEntry.create(owner)];
|
||||
newNote.owner = owner;
|
||||
}
|
||||
return this.noteRepository.save(newNote);
|
||||
|
@ -153,12 +156,14 @@ export class NotesService {
|
|||
id: '1',
|
||||
identities: [],
|
||||
ownedNotes: [],
|
||||
historyEntries: [],
|
||||
updatedAt: new Date(),
|
||||
userName: 'Testy',
|
||||
},
|
||||
description: 'Very descriptive text.',
|
||||
userPermissions: [],
|
||||
groupPermissions: [],
|
||||
historyEntries: [],
|
||||
tags: [],
|
||||
revisions: Promise.resolve([]),
|
||||
authorColors: [],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue