mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-26 03:33:58 -05:00
AuthorEntity: Add create method
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
4e14053f8f
commit
1dc6db24a9
1 changed files with 14 additions and 0 deletions
|
@ -54,4 +54,18 @@ export class Author {
|
||||||
*/
|
*/
|
||||||
@OneToMany(() => Authorship, (authorship) => authorship.author)
|
@OneToMany(() => Authorship, (authorship) => authorship.author)
|
||||||
authorships: Authorship[];
|
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