mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 09:45:37 -04:00
Move publicID
creation to Note.create
Before this commit, `Note.create()` did not return a complete object, as the `publicId` property was missing. This adds the generation of the property to the `create` method and moves the actual generation code from the `NotesService` to a utility method. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
112e6d8c5d
commit
a2e8c3d031
3 changed files with 19 additions and 10 deletions
|
@ -21,6 +21,7 @@ import { AuthorColor } from './author-color.entity';
|
|||
import { Tag } from './tag.entity';
|
||||
import { HistoryEntry } from '../history/history-entry.entity';
|
||||
import { MediaUpload } from '../media/media-upload.entity';
|
||||
import { generatePublicId } from './utils';
|
||||
|
||||
@Entity()
|
||||
export class Note {
|
||||
|
@ -85,6 +86,7 @@ export class Note {
|
|||
|
||||
public static create(owner?: User, alias?: string): Note {
|
||||
const newNote = new Note();
|
||||
newNote.publicId = generatePublicId();
|
||||
newNote.alias = alias ?? null;
|
||||
newNote.viewCount = 0;
|
||||
newNote.owner = owner ?? null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue