Files
edr-platform/apps/edr-freight-api/src/modules/rule-engine/dto/create-approval-rule.dto.ts
2026-05-30 10:27:59 +03:00

32 lines
1005 B
TypeScript

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsBoolean, IsInt, IsOptional, IsString, MaxLength, Min } from 'class-validator';
const ROLES = ['LINE_STAFF', 'DIRECTOR', 'CEO'] as const;
export class CreateApprovalRuleDto {
@ApiProperty({ description: 'True = Director+CEO chain; False = LineStaff+Director chain' })
@IsBoolean()
requiresDirectorApproval!: boolean;
@ApiProperty({ description: 'Step sequence number (1 = first, 2 = second)', minimum: 1 })
@IsInt()
@Min(1)
stepOrder!: number;
@ApiProperty({ enum: ROLES, description: 'Role required to action this step' })
@IsString()
@MaxLength(30)
requiredRole!: string;
@ApiProperty({ description: 'Label shown in UI, e.g. "Review & Approve"', maxLength: 50 })
@IsString()
@MaxLength(50)
actionLabel!: string;
@ApiPropertyOptional({ enum: ROLES, description: 'Role explicitly blocked from actioning this step' })
@IsOptional()
@IsString()
@MaxLength(30)
blocksRole?: string;
}