RevisionEntity: Add create() method

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2020-09-19 16:04:30 +02:00
parent 32a6396a50
commit 58e2932c1a
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

View file

@ -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;
}
}