Rename Authorship entity to Edit

As we now have a separate Author entity, which holds information
about an author (the color), the Authorship name became confusing.
Edit seems to be a better name, as the entity saves information
about a change in a note.

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-05-31 21:46:41 +02:00
parent 5846ca75a9
commit b2d37abf6c
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
19 changed files with 67 additions and 73 deletions

View file

@ -0,0 +1,61 @@
/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import {
Column,
CreateDateColumn,
Entity,
ManyToMany,
ManyToOne,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
import { Author } from '../authors/author.entity';
import { Revision } from './revision.entity';
/**
* The Edit represents a change in the content of a note by a particular {@link Author}
*/
@Entity()
export class Edit {
@PrimaryGeneratedColumn('uuid')
id: string;
/**
* Revisions this edit appears in
*/
@ManyToMany((_) => Revision, (revision) => revision.edits)
revisions: Revision[];
/**
* Author that created the change
*/
@ManyToOne(() => Author, (author) => author.edits)
author: Author;
@Column()
startPos: number;
@Column()
endPos: number;
@CreateDateColumn()
createdAt: Date;
@UpdateDateColumn()
updatedAt: Date;
// eslint-disable-next-line @typescript-eslint/no-empty-function
private constructor() {}
public static create(author: Author, startPos: number, endPos: number) {
const newEdit = new Edit();
newEdit.author = author;
newEdit.startPos = startPos;
newEdit.endPos = endPos;
return newEdit;
}
}