import { PrimaryGeneratedColumn, Column, OneToMany, Entity, ManyToOne } from "typeorm"; import { IsInt, IsNotEmpty, IsOptional, IsString, } from "class-validator"; import { User } from './User'; /** * Defines the UserAction interface. */ @Entity() export class UserAction { /** * Autogenerated unique id (primary key). */ @PrimaryGeneratedColumn() @IsOptional() @IsInt() id: number; /** * user */ @ManyToOne(() => User, user => user.actions) user: User /** * The actions's target (e.g. Track#2) */ @Column() @IsNotEmpty() @IsString() target: string; /** * The actions's action (e.g. UPDATE) */ @Column() @IsNotEmpty() @IsString() action: string; /** * The description of change (before-> after; e.g. distance:15->17) */ @Column({ nullable: true }) @IsOptional() @IsString() changed: string; }