| 1 | import { ApiProperty } from '@nestjs/swagger'; |
| 2 | import { Type } |
| 3 | import { |
| 4 | IsArray, |
| 5 | IsBoolean, |
| 6 | IsISO8601, |
| 7 | IsOptional, |
| 8 | IsString, |
| 9 | ValidateNested, |
| 10 | } from 'class-validator'; |
| 11 | |
| 12 | export class RepositorySearchResultDTO |
| 13 | @ApiProperty() |
| 14 | @IsString() |
| 15 | id: string; |
| 16 | |
| 17 | @ApiProperty({ example |
| 18 | @IsString() |
| 19 | owner: string; |
| 20 | |
| 21 | @ApiProperty({ example |
| 22 | @IsString() |
| 23 | name: string; |
| 24 | |
| 25 | @ApiProperty({ example |
| 26 | @IsString() |
| 27 | slug: string; |
| 28 | |
| 29 | @ApiProperty({ type |
| 30 | @IsString() |
| 31 | @IsOptional() |
| 32 | description: string |
| 33 | |
| 34 | @ApiProperty({ type |
| 35 | @IsISO8601() |
| 36 | lastPushedAt: Date |
| 37 | } |
| 38 | |
| 39 | export class SearchRepositoriesResponseDTO |
| 40 | @ApiProperty({ type |
| 41 | @IsArray() |
| 42 | @ValidateNested({ each |
| 43 | @Type(() => |
| 44 | repositories: RepositorySearchResultDTO |
| 45 | |
| 46 | @ApiProperty({ |
| 47 | type: String, |
| 48 | nullable: true, |
| 49 | description: |
| 50 | 'Pass back as `cursor` for the next page. `null` on the last page.', |
| 51 | }) |
| 52 | @IsString() |
| 53 | @IsOptional() |
| 54 | nextCursor: string |
| 55 | |
| 56 | @ApiProperty() |
| 57 | @IsBoolean() |
| 58 | hasMore: boolean; |
| 59 | } |