Intruduced a new folder structure for action models

ref #76
This commit is contained in:
2021-01-10 16:10:02 +01:00
parent ee9df21ae5
commit 3bc172e7e0
31 changed files with 291 additions and 291 deletions

View File

@@ -0,0 +1,33 @@
import { IsOptional, IsString } from 'class-validator';
import { UserGroup } from '../entities/UserGroup';
/**
* This classed is used to create a new UserGroup entity from a json body (post request).
*/
export class CreateUserGroup {
/**
* The new group's name.
*/
@IsString()
name: string;
/**
* The new group's description.
* Optinal.
*/
@IsOptional()
@IsString()
description?: string;
/**
* Creates a new UserGroup entity from this.
*/
public async toUserGroup(): Promise<UserGroup> {
let newUserGroup: UserGroup = new UserGroup();
newUserGroup.name = this.name;
newUserGroup.description = this.description;
return newUserGroup;
}
}