Code + comment cleanup for the response models

ref #39
This commit is contained in:
2020-12-20 19:38:22 +01:00
parent a85d52437b
commit 75332983c2
13 changed files with 83 additions and 91 deletions

View File

@@ -10,11 +10,11 @@ import { PermissionTarget } from '../enums/PermissionTargets';
import { ResponsePrincipal } from './ResponsePrincipal';
/**
* Defines a track of given length.
* Defines the permission response.
*/
export class ResponsePermission {
/**
* Autogenerated unique id (primary key).
* The permission's id.
*/
@IsInt()
id: number;;
@@ -40,6 +40,10 @@ export class ResponsePermission {
@IsEnum(PermissionAction)
action: PermissionAction;
/**
* Creates a ResponsePermission object from a permission.
* @param permission The permission the response shall be build for.
*/
public constructor(permission: Permission) {
this.id = permission.id;
this.principal = permission.principal.toResponse();