add: nodes

This commit is contained in:
Den Piligrim
2026-05-18 15:50:36 +03:00
parent 9bf4d34317
commit 5629b43cd0
23 changed files with 1148 additions and 53 deletions
+49
View File
@@ -0,0 +1,49 @@
import {
IsBoolean,
IsEnum,
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;
@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;
}