46
src/models/responses/ResponsePermission.ts
Normal file
46
src/models/responses/ResponsePermission.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import {
|
||||
IsInt,
|
||||
IsNotEmpty,
|
||||
IsObject
|
||||
} from "class-validator";
|
||||
import { Permission } from '../entities/Permission';
|
||||
import { Principal } from '../entities/Principal';
|
||||
import { PermissionAction } from '../enums/PermissionAction';
|
||||
import { PermissionTarget } from '../enums/PermissionTargets';
|
||||
|
||||
/**
|
||||
* Defines a track of given length.
|
||||
*/
|
||||
export class ResponsePermission {
|
||||
/**
|
||||
* Autogenerated unique id (primary key).
|
||||
*/
|
||||
@IsInt()
|
||||
id: number;;
|
||||
|
||||
/**
|
||||
* The permissions's principal.
|
||||
*/
|
||||
@IsObject()
|
||||
@IsNotEmpty()
|
||||
principal: Principal;
|
||||
|
||||
/**
|
||||
* The permissions's target.
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
target: PermissionTarget;
|
||||
|
||||
/**
|
||||
* The permissions's action.
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
action: PermissionAction;
|
||||
|
||||
public constructor(permission: Permission) {
|
||||
this.id = permission.id;
|
||||
this.principal = permission.principal;
|
||||
this.target = permission.target;
|
||||
this.action = permission.action;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user