From 82ca8f48dc8cd5438ba1eeab7b222b1df60355df Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Wed, 2 Dec 2020 18:27:00 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20UserAction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/UserAction.ts | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/models/UserAction.ts diff --git a/src/models/UserAction.ts b/src/models/UserAction.ts new file mode 100644 index 0000000..7f6dc43 --- /dev/null +++ b/src/models/UserAction.ts @@ -0,0 +1,48 @@ +import { PrimaryGeneratedColumn, Column, OneToMany, Entity } from "typeorm"; +import { + IsInt, + IsNotEmpty, + IsOptional, + IsString, +} from "class-validator"; + +/** + * Defines the UserAction interface. +*/ +@Entity() +export class UserAction { + /** + * Autogenerated unique id (primary key). + */ + @PrimaryGeneratedColumn() + @IsOptional() + @IsInt() + id: number; + + // TODO: + // user: relation + + /** + * 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() + @IsOptional() + @IsString() + changed: string; +} \ No newline at end of file