Files
ftb-project-management/apps/server/src/modules/governance/dto/governance-dictionary.dto.ts
2026-07-08 16:44:57 +08:00

57 lines
1.1 KiB
TypeScript

import { IsArray, IsIn, IsOptional, IsString, ValidateNested } from 'class-validator';
import { Type } from 'class-transformer';
import { GOVERNANCE_DICTIONARY_KINDS, type GovernanceDictionaryKind } from '../governance.service';
export class GovernanceDictionaryDto {
@IsString()
actorId!: string;
@IsIn(GOVERNANCE_DICTIONARY_KINDS)
kind!: GovernanceDictionaryKind;
@IsString()
name!: string;
@IsOptional()
@IsString()
code?: string;
@IsOptional()
@IsString()
group?: string;
@IsOptional()
@IsString()
scope?: string;
@IsOptional()
@IsArray()
@IsString({ each: true })
permissions?: string[];
}
export class RemoveGovernanceDictionaryDto {
@IsString()
actorId!: string;
@IsOptional()
@IsArray()
@IsString({ each: true })
permissions?: string[];
}
export class ImportGovernanceDictionariesDto {
@IsString()
actorId!: string;
@IsOptional()
@IsArray()
@IsString({ each: true })
permissions?: string[];
@IsArray()
@ValidateNested({ each: true })
@Type(() => GovernanceDictionaryDto)
items!: GovernanceDictionaryDto[];
}