| 1 | import { ApiProperty } from '@nestjs/swagger'; |
| 2 | import { Type } |
| 3 | import { |
| 4 | IsISO8601, |
| 5 | IsNotEmpty, |
| 6 | IsString, |
| 7 | Matches, |
| 8 | MaxLength, |
| 9 | ValidateNested, |
| 10 | } from 'class-validator'; |
| 11 | |
| 12 | export class IssueCommentDTO |
| 13 | @ApiProperty() |
| 14 | @IsString() |
| 15 | id: string; |
| 16 | |
| 17 | @ApiProperty({ description |
| 18 | @IsString() |
| 19 | body: string; |
| 20 | |
| 21 | @ApiProperty() |
| 22 | @IsString() |
| 23 | authorUsername: string; |
| 24 | |
| 25 | @ApiProperty() |
| 26 | @IsISO8601() |
| 27 | createdAt: string; |
| 28 | |
| 29 | @ApiProperty() |
| 30 | @IsISO8601() |
| 31 | updatedAt: string; |
| 32 | } |
| 33 | |
| 34 | export class CreateIssueCommentRequestDTO |
| 35 | @ApiProperty({ maxLength |
| 36 | @IsString() |
| 37 | @IsNotEmpty() |
| 38 | @Matches(/.* |
| 39 | @MaxLength(20000) |
| 40 | body: string; |
| 41 | } |
| 42 | |
| 43 | export class UpdateIssueCommentRequestDTO |
| 44 | @ApiProperty({ maxLength |
| 45 | @IsString() |
| 46 | @IsNotEmpty() |
| 47 | @Matches(/.* |
| 48 | @MaxLength(20000) |
| 49 | body: string; |
| 50 | } |
| 51 | |
| 52 | export class GetIssueCommentsResponseDTO |
| 53 | @ApiProperty({ type |
| 54 | @ValidateNested({ each |
| 55 | @Type(() => |
| 56 | comments: IssueCommentDTO |
| 57 | } |