18 lines
611 B
TypeScript
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;
|
|
}
|