- add optional description to scenario and environment entities - expose description in create/update DTOs, MCP tools, and export DTOs - render description as markdown on detail pages - add description editor (CodeEditor) to create/edit forms for both resources
60 lines
1.0 KiB
TypeScript
60 lines
1.0 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
|
import { Type } from "class-transformer";
|
|
import {
|
|
IsArray,
|
|
IsIn,
|
|
IsNotEmpty,
|
|
IsOptional,
|
|
IsString,
|
|
IsUUID,
|
|
ValidateNested,
|
|
} from "class-validator";
|
|
|
|
export class ScenarioStepExportDto {
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
title: string | null;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
execCode: string | null;
|
|
}
|
|
|
|
export class ScenarioExportDto {
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsIn(["scenario"])
|
|
kind?: "scenario";
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsUUID()
|
|
id?: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
title?: string;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
name: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
description?: string;
|
|
|
|
@ApiProperty({ type: [ScenarioStepExportDto] })
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => ScenarioStepExportDto)
|
|
steps: ScenarioStepExportDto[];
|
|
}
|