| 1 | import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; |
| 2 | import { Type } |
| 3 | import { IsInt, IsOptional |
| 4 | |
| 5 | export class GetUserContributionsQueryDTO |
| 6 | @ApiPropertyOptional({ |
| 7 | description: 'Calendar year to render. Defaults to the current year.', |
| 8 | example: 2026, |
| 9 | }) |
| 10 | @Type(() => |
| 11 | @IsInt() |
| 12 | @Min(2000) |
| 13 | @Max(2100) |
| 14 | @IsOptional() |
| 15 | year?: number |
| 16 | } |
| 17 | |
| 18 | export class ContributionDayDTO |
| 19 | @ApiProperty({ |
| 20 | description: 'Calendar day, YYYY-MM-DD (UTC).', |
| 21 | example: '2026-09-18', |
| 22 | }) |
| 23 | date: string; |
| 24 | |
| 25 | @ApiProperty({ description |
| 26 | count: number; |
| 27 | } |
| 28 | |
| 29 | export class GetUserContributionsResponseDTO |
| 30 | @ApiProperty() |
| 31 | username: string; |
| 32 | |
| 33 | @ApiProperty({ description |
| 34 | year: number; |
| 35 | |
| 36 | @ApiProperty({ |
| 37 | description: |
| 38 | 'Commits authored that year across visible owned repositories.', |
| 39 | }) |
| 40 | totalContributions: number; |
| 41 | |
| 42 | @ApiProperty({ |
| 43 | type: [ContributionDayDTO], |
| 44 | description: 'Every day of the year, in order.', |
| 45 | }) |
| 46 | days: ContributionDayDTO |
| 47 | } |