mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-27 03:58:02 -05:00
AuthorEntity: Add create method
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
228c2941e5
commit
62e442343a
1 changed files with 14 additions and 0 deletions
|
@ -54,4 +54,18 @@ export class Author {
|
|||
*/
|
||||
@OneToMany(() => Authorship, (authorship) => authorship.author)
|
||||
authorships: Authorship[];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
private constructor() {}
|
||||
|
||||
public static create(
|
||||
color: number,
|
||||
): Pick<Author, 'color' | 'sessions' | 'user' | 'authorships'> {
|
||||
const newAuthor = new Author();
|
||||
newAuthor.color = color;
|
||||
newAuthor.sessions = [];
|
||||
newAuthor.user = null;
|
||||
newAuthor.authorships = [];
|
||||
return newAuthor;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue