46 lines
850 B
TypeScript
46 lines
850 B
TypeScript
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;
|
|
}
|
|
}
|