| 1 | import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; |
| 2 | import { Type } |
| 3 | import { IsInt, IsOptional |
| 4 | |
| 5 | export class GetRepositoryContributorsQueryDTO |
| 6 | @ApiPropertyOptional({ |
| 7 | description: 'Maximum contributors to return.', |
| 8 | minimum: 1, |
| 9 | maximum: 100, |
| 10 | default: 100, |
| 11 | }) |
| 12 | @Type(() => |
| 13 | @IsInt() |
| 14 | @Min(1) |
| 15 | @Max(100) |
| 16 | @IsOptional() |
| 17 | limit?: number |
| 18 | } |
| 19 | |
| 20 | export class ContributorDTO |
| 21 | @ApiProperty({ |
| 22 | description: |
| 23 | 'Linked Ghost username, when the commit email matches an account.', |
| 24 | type: String, |
| 25 | nullable: true, |
| 26 | }) |
| 27 | username: string |
| 28 | |
| 29 | @ApiProperty({ description |
| 30 | name: string; |
| 31 | |
| 32 | @ApiProperty({ |
| 33 | description: 'Avatar of the linked account, if any.', |
| 34 | type: String, |
| 35 | nullable: true, |
| 36 | }) |
| 37 | image: string |
| 38 | |
| 39 | @ApiProperty({ description |
| 40 | commits: number; |
| 41 | |
| 42 | @ApiProperty({ description |
| 43 | percent: number; |
| 44 | |
| 45 | @ApiProperty({ |
| 46 | description: |
| 47 | 'Day of the author’s most recent commit, ISO 8601 at UTC midnight. Day-granular: the index stores days, not timestamps.', |
| 48 | }) |
| 49 | lastCommittedAt: string; |
| 50 | } |
| 51 | |
| 52 | export class GetRepositoryContributorsResponseDTO |
| 53 | @ApiProperty({ type |
| 54 | contributors: ContributorDTO |
| 55 | |
| 56 | @ApiProperty({ description |
| 57 | totalCommits: number; |
| 58 | |
| 59 | @ApiProperty({ description |
| 60 | totalContributors: number; |
| 61 | } |