Files
3dp-manager/server/src/nodes/dto/node.dto.ts
T
Den Piligrim 26f3bb2934 v2.2.0
2026-05-21 22:58:29 +03:00

63 lines
1.1 KiB
TypeScript

import {
IsBoolean,
IsEnum,
IsIP,
IsOptional,
IsString,
MinLength,
ValidateIf,
} from 'class-validator';
import { PartialType } from '@nestjs/mapped-types';
import { NodeAuthType } from '../entities/node.entity';
export class CreateNodeDto {
@IsString()
@MinLength(2)
name: string;
@IsString()
url: string;
@IsIP()
@IsOptional()
ip?: string;
@IsString()
@IsOptional()
domain?: string;
@IsString()
@IsOptional()
flag?: string;
@IsEnum(NodeAuthType)
authType: NodeAuthType;
@ValidateIf((dto: CreateNodeDto) => dto.authType === NodeAuthType.Password)
@IsString()
login?: string;
@ValidateIf((dto: CreateNodeDto) => dto.authType === NodeAuthType.Password)
@IsString()
password?: string;
@ValidateIf((dto: CreateNodeDto) => dto.authType === NodeAuthType.Token)
@IsString()
token?: string;
@IsBoolean()
@IsOptional()
isMain?: boolean;
@IsString()
@IsOptional()
version?: string;
}
export class UpdateNodeDto extends PartialType(CreateNodeDto) {}
export class NodeConnectionDto {
@IsString()
id: string;
}