Files
tessera-ctl/apps/api/src/domaincheck/dto/check-domain.dto.ts
T
schalli 2e0a4ddc21 feat(03-02): add domaincheck backend - DNS service, API endpoint, module seed
- CheckDomainDto with regex validation (T-03-05) and max 10 TLDs (T-03-06)
- DomaincheckService using node:dns/promises with 5s timeout per lookup
- POST /modules/domaincheck/check protected by UseModule guard (T-03-08)
- DomaincheckModule seeds itself into registry on startup via OnModuleInit
- Default TLDs: de, com, net, org (D-03)
2026-06-19 13:24:26 +02:00

35 lines
884 B
TypeScript

import {
ArrayMaxSize,
IsArray,
IsNotEmpty,
IsOptional,
IsString,
Matches,
} from 'class-validator';
/**
* DTO for domain availability check requests.
*
* Per T-03-05: domain input is validated with regex — only alphanumeric
* characters and hyphens allowed, no dots, max 63 chars (DNS label limit).
*/
export class CheckDomainDto {
@IsString()
@IsNotEmpty()
@Matches(/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/, {
message:
'Domain must be a valid label: alphanumeric and hyphens only, 1-63 characters, cannot start or end with a hyphen',
})
domain!: string;
/**
* Optional list of TLDs to check. If omitted, defaults are used.
* Per T-03-06: max 10 TLDs per request to prevent DoS.
*/
@IsOptional()
@IsArray()
@IsString({ each: true })
@ArrayMaxSize(10, { message: 'Maximum 10 TLDs per request' })
tlds?: string[];
}