Code + comment cleanup for the entities

ref #39
This commit is contained in:
2020-12-21 15:29:32 +01:00
parent a03f1a438d
commit d20d738218
21 changed files with 156 additions and 87 deletions

View File

@@ -1,14 +1,17 @@
import {
IsEnum,
IsInt,
IsNotEmpty,
IsOptional,
IsString
} from "class-validator";
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
import { PermissionAction } from '../enums/PermissionAction';
import { User } from './User';
/**
* Defines the UserAction interface.
* Defines the UserAction entity.
* Will later be used to document a user's actions.
*/
@Entity()
export class UserAction {
@@ -20,7 +23,7 @@ export class UserAction {
id: number;
/**
* user
* The user that performed the action.
*/
@ManyToOne(() => User, user => user.actions)
user: User
@@ -34,15 +37,16 @@ export class UserAction {
target: string;
/**
* The actions's action (e.g. UPDATE)
* The actions's action (e.g. UPDATE).
* Directly pulled from the PermissionAction Enum.
*/
@Column()
@IsNotEmpty()
@IsString()
action: string;
@Column({ type: 'varchar' })
@IsEnum(PermissionAction)
action: PermissionAction;
/**
* The description of change (before-> after; e.g. distance:15->17)
* The description of the change (before-> after; e.g. distance:15->17).
* Will later be defined in more detail.
*/
@Column({ nullable: true })
@IsOptional()