From 58e2932c1a7e14cfd38422413db1a85ce1b53ef2 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Sat, 19 Sep 2020 16:04:30 +0200 Subject: [PATCH] RevisionEntity: Add `create()` method Signed-off-by: David Mehren --- src/revisions/revision.entity.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/revisions/revision.entity.ts b/src/revisions/revision.entity.ts index 4427454e2..2c15515af 100644 --- a/src/revisions/revision.entity.ts +++ b/src/revisions/revision.entity.ts @@ -65,4 +65,15 @@ export class Revision { ) @JoinTable() authorships: Authorship[]; + + // eslint-disable-next-line @typescript-eslint/no-empty-function + private constructor() {} + + static create(content: string, patch: string): Revision { + const newRevision = new Revision(); + newRevision.patch = patch; + newRevision.content = content; + newRevision.length = content.length; + return newRevision; + } }