45
src/models/responses/ResponseUserGroup.ts
Normal file
45
src/models/responses/ResponseUserGroup.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user