File

src/iam/policy/dto/create-policy.dto.ts

Index

Properties

Properties

name
Type : string
Decorators :
@IsNotEmpty()
@IsString()
@ApiProperty({required: true})
statements
Type : CreateStatementDto[]
Decorators :
@IsNotEmpty()
@ArrayNotEmpty()
@ApiProperty({type: undefined, required: true})
@ValidateNested({each: true})
@Type(undefined)
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[];
}

results matching ""

    No results matching ""