mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-22 19:25:18 -04:00
Add authorship entity.
It stores which parts of a revision were edited by a particular user. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
a6fa562a17
commit
c6816f9bba
2 changed files with 47 additions and 1 deletions
45
src/revisions/authorship.entity.ts
Normal file
45
src/revisions/authorship.entity.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
import {
|
||||
Column, CreateDateColumn,
|
||||
Entity,
|
||||
ManyToMany,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn, UpdateDateColumn,
|
||||
} from 'typeorm/index';
|
||||
import { User } from '../users/user.entity';
|
||||
import { Revision } from './revision.entity';
|
||||
|
||||
/**
|
||||
* This class stores which parts of a revision were edited by a particular user.
|
||||
*/
|
||||
@Entity()
|
||||
export class Authorship {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Revisions this authorship appears in
|
||||
*/
|
||||
@ManyToMany(
|
||||
_ => Revision,
|
||||
revision => revision.authorships,
|
||||
)
|
||||
revisions: Revision[];
|
||||
|
||||
/**
|
||||
* User this authorship represents
|
||||
*/
|
||||
@ManyToOne(_ => User)
|
||||
user: User;
|
||||
|
||||
@Column()
|
||||
startPos: number
|
||||
|
||||
@Column()
|
||||
endPos: number
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date
|
||||
|
||||
@UpdateDateColumn()
|
||||
updatedAt: Date
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue