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)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
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[];
|
||||
}
|
||||
Reference in New Issue
Block a user