src/iam/policy/dto/create-policy.dto.ts
Properties |
| name |
Type : string
|
Decorators :
@IsNotEmpty()
|
|
Defined in src/iam/policy/dto/create-policy.dto.ts:24
|
| statements |
Type : CreateStatementDto[]
|
Decorators :
@IsNotEmpty()
|
|
Defined in src/iam/policy/dto/create-policy.dto.ts:34
|
import { ApiProperty } from "@nestjs/swagger";
import { Type } from "class-transformer";
import {
ArrayNotEmpty,
IsNotEmpty,
IsString,
ValidateNested,
} from "class-validator";
export class CreateStatementDto {
@IsNotEmpty()
@ApiProperty({ required: true })
action: string;
@IsNotEmpty()
@ApiProperty({ required: true })
resource: string;
}
export class CreatePolicyDto {
@IsNotEmpty()
@IsString()
@ApiProperty({ required: true })
name: string;
@IsNotEmpty()
@ArrayNotEmpty()
@ApiProperty({
type: [CreateStatementDto],
required: true,
})
@ValidateNested({ each: true })
@Type(() => CreateStatementDto)
statements: CreateStatementDto[];
}