Files
dmail-api/src/modules/domains/DTO/create-domain.dto.ts
T
2025-07-02 21:05:13 +03:30

18 lines
611 B
TypeScript

import { ApiProperty } from "@nestjs/swagger";
import { IsNotEmpty, IsOptional, IsString, Matches, MaxLength } from "class-validator";
export class CreateDomainDto {
@IsNotEmpty()
@IsString()
@MaxLength(255)
@Matches(/^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9](?:\.[a-zA-Z]{2,})+$/, { message: "Domain name must be a valid domain format" })
@ApiProperty({ description: "The name of the domain", example: "example.com" })
name!: string;
@IsString()
@IsOptional()
@MaxLength(1000)
@ApiProperty({ description: "The notes of the domain", example: "This is a test domain" })
notes?: string;
}