30 lines
646 B
TypeScript
30 lines
646 B
TypeScript
import { IsOptional, IsString } from 'class-validator';
|
|
import { UserGroup } from '../entities/UserGroup';
|
|
|
|
export class CreateUserGroup {
|
|
/**
|
|
* The new group's name.
|
|
*/
|
|
@IsString()
|
|
name: string;
|
|
|
|
/**
|
|
* The new group's description.
|
|
* Optinal.
|
|
*/
|
|
@IsOptional()
|
|
@IsString()
|
|
description?: string;
|
|
|
|
/**
|
|
* Converts this to a UserGroup entity.
|
|
*/
|
|
public async toUserGroup(): Promise<UserGroup> {
|
|
let newUserGroup: UserGroup = new UserGroup();
|
|
|
|
newUserGroup.name = this.name;
|
|
newUserGroup.description = this.description;
|
|
|
|
return newUserGroup;
|
|
}
|
|
} |