🚧 UserAction relation
This commit is contained in:
parent
aa565c6b34
commit
f50e7f0b3a
@ -2,6 +2,7 @@ import { Entity, Column, OneToMany, ManyToOne, PrimaryGeneratedColumn, Generated
|
|||||||
import { IsBoolean, IsEmail, IsInt, IsNotEmpty, IsOptional, IsString, isUUID, } from "class-validator";
|
import { IsBoolean, IsEmail, IsInt, IsNotEmpty, IsOptional, IsString, isUUID, } from "class-validator";
|
||||||
import { UserGroup } from './UserGroup';
|
import { UserGroup } from './UserGroup';
|
||||||
import { Permission } from './Permission';
|
import { Permission } from './Permission';
|
||||||
|
import { UserAction } from './UserAction';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a admin user.
|
* Defines a admin user.
|
||||||
@ -96,6 +97,12 @@ export class User {
|
|||||||
@IsString()
|
@IsString()
|
||||||
profilepic: string;
|
profilepic: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* actions
|
||||||
|
*/
|
||||||
|
@OneToMany(() => UserAction, action => action.user)
|
||||||
|
actions: UserAction
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* calculate all permissions
|
* calculate all permissions
|
||||||
*/
|
*/
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { PrimaryGeneratedColumn, Column, OneToMany, Entity } from "typeorm";
|
import { PrimaryGeneratedColumn, Column, OneToMany, Entity, ManyToOne } from "typeorm";
|
||||||
import {
|
import {
|
||||||
IsInt,
|
IsInt,
|
||||||
IsNotEmpty,
|
IsNotEmpty,
|
||||||
IsOptional,
|
IsOptional,
|
||||||
IsString,
|
IsString,
|
||||||
} from "class-validator";
|
} from "class-validator";
|
||||||
|
import { User } from './User';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the UserAction interface.
|
* Defines the UserAction interface.
|
||||||
@ -19,8 +20,11 @@ export class UserAction {
|
|||||||
@IsInt()
|
@IsInt()
|
||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
// TODO:
|
/**
|
||||||
// user: relation
|
* user
|
||||||
|
*/
|
||||||
|
@ManyToOne(() => User, user => user.actions)
|
||||||
|
user: User
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The actions's target (e.g. Track#2)
|
* The actions's target (e.g. Track#2)
|
||||||
@ -41,7 +45,7 @@ export class UserAction {
|
|||||||
/**
|
/**
|
||||||
* The description of change (before-> after; e.g. distance:15->17)
|
* The description of change (before-> after; e.g. distance:15->17)
|
||||||
*/
|
*/
|
||||||
@Column({nullable: true})
|
@Column({ nullable: true })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
changed: string;
|
changed: string;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user