Now with cleaner participants in the responses

ref #6
This commit is contained in:
2020-12-18 15:26:54 +01:00
parent dc485c02ea
commit 145a08b1b4
5 changed files with 63 additions and 3 deletions

View File

@@ -0,0 +1,45 @@
import {
IsArray,
IsNotEmpty,
IsOptional,
IsString
} from "class-validator";
import { Permission } from '../entities/Permission';
import { UserGroup } from '../entities/UserGroup';
import { ResponsePrincipal } from './ResponsePrincipal';
/**
* Defines a user response.
*/
export class ResponseUserGroup extends ResponsePrincipal {
/**
* The group's name
*/
@IsNotEmpty()
@IsString()
name: string;
/**
* The group's description
*/
@IsOptional()
@IsString()
description?: string;
/**
* permissions
*/
@IsArray()
@IsOptional()
permissions: Permission[];
public constructor(group: UserGroup) {
super(group);
this.name = group.name;
this.description = group.description;
this.permissions = group.permissions;
}
}