mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-07 18:04:56 -04:00
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:
parent
5846ca75a9
commit
b2d37abf6c
19 changed files with 67 additions and 73 deletions
|
@ -11,7 +11,7 @@ import {
|
|||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
import { Authorship } from '../revisions/authorship.entity';
|
||||
import { Edit } from '../revisions/edit.entity';
|
||||
import { Session } from '../users/session.entity';
|
||||
import { User } from '../users/user.entity';
|
||||
|
||||
|
@ -20,7 +20,7 @@ export type AuthorColor = number;
|
|||
/**
|
||||
* The author represents a single user editing a note.
|
||||
* A 'user' can either be a registered and logged-in user or a browser session identified by its cookie.
|
||||
* All edits (aka authorships) of one user in a note must belong to the same author, so that the same color can be displayed.
|
||||
* All edits of one user in a note must belong to the same author, so that the same color can be displayed.
|
||||
*/
|
||||
@Entity()
|
||||
export class Author {
|
||||
|
@ -49,23 +49,23 @@ export class Author {
|
|||
user: User | null;
|
||||
|
||||
/**
|
||||
* List of authorships that this author created
|
||||
* All authorships must belong to the same note
|
||||
* List of edits that this author created
|
||||
* All edits must belong to the same note
|
||||
*/
|
||||
@OneToMany(() => Authorship, (authorship) => authorship.author)
|
||||
authorships: Authorship[];
|
||||
@OneToMany(() => Edit, (edit) => edit.author)
|
||||
edits: Edit[];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
private constructor() {}
|
||||
|
||||
public static create(
|
||||
color: number,
|
||||
): Pick<Author, 'color' | 'sessions' | 'user' | 'authorships'> {
|
||||
): Pick<Author, 'color' | 'sessions' | 'user' | 'edits'> {
|
||||
const newAuthor = new Author();
|
||||
newAuthor.color = color;
|
||||
newAuthor.sessions = [];
|
||||
newAuthor.user = null;
|
||||
newAuthor.authorships = [];
|
||||
newAuthor.edits = [];
|
||||
return newAuthor;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue