| 1 | import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; |
| 2 | import { Transform } |
| 3 | import { |
| 4 | IsOptional, |
| 5 | IsString, |
| 6 | Matches, |
| 7 | MaxLength, |
| 8 | MinLength, |
| 9 | } from 'class-validator'; |
| 10 | |
| 11 | const HEX_COLOR = / |
| 12 | export class GithubCreateLabelDTO |
| 13 | @ApiProperty({ example |
| 14 | @Transform(({ |
| 15 | @IsString() |
| 16 | @MinLength(1) |
| 17 | @MaxLength(50) |
| 18 | name: string; |
| 19 | |
| 20 | @ApiPropertyOptional({ example |
| 21 | @IsOptional() |
| 22 | @IsString() |
| 23 | @Matches(HEX_COLOR) |
| 24 | @Transform(({ |
| 25 | typeof value === ' |
| 26 | ) |
| 27 | color?: string |
| 28 | |
| 29 | @ApiPropertyOptional() |
| 30 | @IsOptional() |
| 31 | @IsString() |
| 32 | @MaxLength(100) |
| 33 | description?: string |
| 34 | } |
| 35 | |
| 36 | export class GithubUpdateLabelDTO |
| 37 | @ApiPropertyOptional({ example |
| 38 | @IsOptional() |
| 39 | @Transform(({ |
| 40 | @IsString() |
| 41 | @MinLength(1) |
| 42 | @MaxLength(50) |
| 43 | new_name?: string |
| 44 | |
| 45 | @ApiPropertyOptional({ example |
| 46 | @IsOptional() |
| 47 | @IsString() |
| 48 | @Matches(HEX_COLOR) |
| 49 | @Transform(({ |
| 50 | typeof value === ' |
| 51 | ) |
| 52 | color?: string |
| 53 | |
| 54 | @ApiPropertyOptional({ type |
| 55 | @IsOptional() |
| 56 | @IsString() |
| 57 | @MaxLength(100) |
| 58 | description?: string |
| 59 | } |