34 lines
698 B
TypeScript
34 lines
698 B
TypeScript
import { IsOptional, IsString, IsUrl, Matches, MaxLength } from 'class-validator';
|
|
|
|
export class CreateWorkspaceDto {
|
|
@IsString()
|
|
@MaxLength(255)
|
|
name!: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@MaxLength(10_000)
|
|
description?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
teamId?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@Matches(/^(?:https|git):\/\//i, {
|
|
message: 'repoUrl must be a valid https:// or git:// URL',
|
|
})
|
|
@IsUrl(
|
|
{
|
|
protocols: ['https', 'git'],
|
|
require_host: true,
|
|
require_protocol: true,
|
|
require_tld: false,
|
|
require_valid_protocol: true,
|
|
},
|
|
{ message: 'repoUrl must be a valid https:// or git:// URL' },
|
|
)
|
|
repoUrl?: string;
|
|
}
|