Added class validation for the enum

ref #6
This commit is contained in:
2020-12-18 19:49:39 +01:00
parent 595a9213c1
commit 2240a45a91
5 changed files with 13 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
import {
IsEnum,
IsInt,
IsNotEmpty
} from "class-validator";
@@ -29,12 +30,14 @@ export class Permission {
*/
@Column({ type: 'varchar' })
@IsNotEmpty()
@IsEnum(PermissionTarget)
target: PermissionTarget;
/**
* The action type
*/
@Column({ type: 'varchar' })
@IsEnum(PermissionAction)
action: PermissionAction;
/**