Files
fennec-be/src/projects/dtos/create-project.input.ts
2021-05-04 21:05:20 +08:00

42 lines
681 B
TypeScript

import { InputType } from '@nestjs/graphql';
import {
IsOptional,
IsString,
IsUrl,
Matches,
MaxLength,
MinLength,
} from 'class-validator';
@InputType({ isAbstract: true })
export class CreateProjectInput {
@IsString()
@MaxLength(32)
@MinLength(2)
name: string;
@IsString()
@MaxLength(32)
@MinLength(2)
comment: string;
@Matches(
/^(?:ssh:\/\/)?(?:[\w\d-_]+@)?(?:[\w\d-_]+\.)*\w{2,10}(?::\d{1,5})?(?:\/[\w\d-_.]+)*/,
{
message: 'wrong ssh url',
},
)
@MaxLength(256)
sshUrl: string;
@IsUrl()
@IsOptional()
@MaxLength(256)
webUrl?: string;
@IsString()
@MaxLength(128)
@MinLength(1)
webHookSecret?: string;
}