| 1 | import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; |
| 2 | import { Type } |
| 3 | import { |
| 4 | IsOptional, |
| 5 | IsString, |
| 6 | MaxLength, |
| 7 | ValidateNested, |
| 8 | } from 'class-validator'; |
| 9 | |
| 10 | import { PullRequestFileDTO } |
| 11 | |
| 12 | export class CompareQueryDTO |
| 13 | @ApiProperty({ description |
| 14 | @IsString() |
| 15 | @MaxLength(255) |
| 16 | base: string; |
| 17 | |
| 18 | @ApiProperty({ |
| 19 | description: 'Branch the changes come from, `owner:branch` for a fork.', |
| 20 | }) |
| 21 | @IsString() |
| 22 | @MaxLength(511) |
| 23 | head: string; |
| 24 | } |
| 25 | |
| 26 | export class ComparePatchQueryDTO |
| 27 | @ApiPropertyOptional({ description |
| 28 | @IsString() |
| 29 | @IsOptional() |
| 30 | @MaxLength(4096) |
| 31 | path?: string |
| 32 | } |
| 33 | |
| 34 | export class CompareResponseDTO |
| 35 | @ApiProperty({ description |
| 36 | @IsString() |
| 37 | from: string; |
| 38 | |
| 39 | @ApiProperty({ description |
| 40 | @IsString() |
| 41 | to: string; |
| 42 | |
| 43 | @ApiProperty({ type |
| 44 | @ValidateNested({ each |
| 45 | @Type(() => |
| 46 | files: PullRequestFileDTO |
| 47 | } |