| 1 | import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; |
| 2 | import { Type } |
| 3 | import { |
| 4 | IsBoolean, |
| 5 | IsISO8601, |
| 6 | IsInt, |
| 7 | IsOptional, |
| 8 | IsString, |
| 9 | Max, |
| 10 | Min, |
| 11 | } from 'class-validator'; |
| 12 | |
| 13 | export class GetRepositoryStargazersQueryDTO |
| 14 | @ApiPropertyOptional({ |
| 15 | description: |
| 16 | 'Opaque cursor returned as `nextCursor` by the previous page. Omit for the first page.', |
| 17 | }) |
| 18 | @IsString() |
| 19 | @IsOptional() |
| 20 | cursor?: string |
| 21 | |
| 22 | @ApiPropertyOptional({ |
| 23 | description: 'Page size.', |
| 24 | minimum: 1, |
| 25 | maximum: 100, |
| 26 | default: 20, |
| 27 | }) |
| 28 | @Type(() => |
| 29 | @IsInt() |
| 30 | @Min(1) |
| 31 | @Max(100) |
| 32 | @IsOptional() |
| 33 | limit?: number |
| 34 | } |
| 35 | |
| 36 | export class StargazerDTO |
| 37 | @ApiProperty() |
| 38 | @IsString() |
| 39 | username: string; |
| 40 | |
| 41 | @ApiProperty() |
| 42 | @IsString() |
| 43 | name: string; |
| 44 | |
| 45 | @ApiProperty({ type |
| 46 | @IsString() |
| 47 | @IsOptional() |
| 48 | image: string |
| 49 | |
| 50 | @ApiProperty({ description |
| 51 | @IsISO8601() |
| 52 | starredAt: string; |
| 53 | } |
| 54 | |
| 55 | export class GetRepositoryStargazersResponseDTO |
| 56 | @ApiProperty({ type |
| 57 | stargazers: StargazerDTO |
| 58 | |
| 59 | @ApiProperty({ type |
| 60 | @IsString() |
| 61 | @IsOptional() |
| 62 | nextCursor: string |
| 63 | |
| 64 | @ApiProperty() |
| 65 | @IsBoolean() |
| 66 | hasMore: boolean; |
| 67 | } |