| 1 | import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; |
| 2 | import { Transform } |
| 3 | import { IsOptional, IsString |
| 4 | |
| 5 | export class CreateBranchRequestDTO |
| 6 | @ApiProperty({ |
| 7 | description: 'Name of the new branch, without the `refs/heads/` prefix.', |
| 8 | example: 'feat/branches', |
| 9 | }) |
| 10 | @IsString() |
| 11 | @Transform(({ |
| 12 | @MinLength(1) |
| 13 | @MaxLength(250) |
| 14 | name: string; |
| 15 | |
| 16 | @ApiPropertyOptional({ |
| 17 | description: |
| 18 | 'Branch, tag or commit sha the new branch starts at. Defaults to the default branch.', |
| 19 | example: 'main', |
| 20 | }) |
| 21 | @IsString() |
| 22 | @IsOptional() |
| 23 | @MaxLength(250) |
| 24 | from?: string |
| 25 | } |
| 26 | |
| 27 | export class BranchDTO |
| 28 | @ApiProperty({ example |
| 29 | @IsString() |
| 30 | name: string; |
| 31 | |
| 32 | @ApiProperty({ description |
| 33 | @IsString() |
| 34 | sha: string; |
| 35 | } |