From 1dc6db24a9b7b6da0dd0bea879da0934ce441587 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Wed, 19 May 2021 22:12:00 +0200 Subject: [PATCH] AuthorEntity: Add create method Signed-off-by: David Mehren --- src/authors/author.entity.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/authors/author.entity.ts b/src/authors/author.entity.ts index a0ffa44d1..51732c6e8 100644 --- a/src/authors/author.entity.ts +++ b/src/authors/author.entity.ts @@ -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 { + const newAuthor = new Author(); + newAuthor.color = color; + newAuthor.sessions = []; + newAuthor.user = null; + newAuthor.authorships = []; + return newAuthor; + } }