Compare commits
4 Commits
4a9fd57356
...
e4d5afbebe
Author | SHA1 | Date | |
---|---|---|---|
e4d5afbebe | |||
63843cc4c9 | |||
1d57264922 | |||
82ca8f48dc |
37
src/models/Permission.ts
Normal file
37
src/models/Permission.ts
Normal file
@ -0,0 +1,37 @@
|
||||
import { PrimaryGeneratedColumn, Column, OneToMany, Entity } from "typeorm";
|
||||
import {
|
||||
IsInt,
|
||||
IsNotEmpty,
|
||||
IsOptional,
|
||||
IsString,
|
||||
} from "class-validator";
|
||||
|
||||
/**
|
||||
* Defines the Permission interface.
|
||||
*/
|
||||
@Entity()
|
||||
export abstract class Permission {
|
||||
/**
|
||||
* Autogenerated unique id (primary key).
|
||||
*/
|
||||
@PrimaryGeneratedColumn()
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
id: number;
|
||||
|
||||
/**
|
||||
* The target
|
||||
*/
|
||||
@Column()
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
target: string;
|
||||
|
||||
/**
|
||||
* The action type
|
||||
*/
|
||||
@Column()
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
action: string;
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import { Entity, Column, OneToMany, ManyToOne, PrimaryGeneratedColumn, Generated, Unique, JoinTable, ManyToMany } from "typeorm";
|
||||
import { IsBoolean, IsEmail, IsInt, IsNotEmpty, IsOptional, IsString, isUUID, } from "class-validator";
|
||||
import { UserGroup } from './UserGroup';
|
||||
import { Permission } from './Permission';
|
||||
|
||||
/**
|
||||
* Defines a admin user.
|
||||
@ -64,11 +65,11 @@ export class User {
|
||||
password: string;
|
||||
|
||||
/**
|
||||
* userpermissions
|
||||
* permissions
|
||||
*/
|
||||
// TODO: UserPermission implementation
|
||||
// @OneToMany(() => UserPermission,userpermission=>)
|
||||
// userpermissions: UserPermission[];
|
||||
// TODO: Permission implementation
|
||||
// @OneToMany(() => Permission,userpermission=>)
|
||||
// permissions: Permission[];
|
||||
|
||||
/**
|
||||
* groups
|
||||
|
48
src/models/UserAction.ts
Normal file
48
src/models/UserAction.ts
Normal file
@ -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;
|
||||
}
|
@ -5,7 +5,7 @@ import {
|
||||
IsOptional,
|
||||
IsString,
|
||||
} from "class-validator";
|
||||
import { User } from "./User";
|
||||
import { Permission } from "./Permission";
|
||||
|
||||
/**
|
||||
* Defines the UserGroup interface.
|
||||
@ -40,5 +40,5 @@ export abstract class UserGroup {
|
||||
* TODO: Something about permission stuff
|
||||
*/
|
||||
// TODO:
|
||||
// grouppermissions: GroupPermissions[];
|
||||
// grouppermissions: Permission[];
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user