diff --git a/apps/backend/src/issues/dto/create-issue-comment.dto.ts b/apps/backend/src/issues/dto/create-issue-comment.dto.ts index a124656..6c40da3 100644 --- a/apps/backend/src/issues/dto/create-issue-comment.dto.ts +++ b/apps/backend/src/issues/dto/create-issue-comment.dto.ts @@ -1,6 +1,11 @@ import { IsString, MaxLength, MinLength } from 'class-validator'; export class CreateIssueCommentDto { + @IsString() + @MinLength(3) + @MaxLength(16) + username: string; + @IsString() @MinLength(1) @MaxLength(255) diff --git a/apps/backend/src/issues/dto/create-issue.dto.ts b/apps/backend/src/issues/dto/create-issue.dto.ts index 45401c3..09fff86 100644 --- a/apps/backend/src/issues/dto/create-issue.dto.ts +++ b/apps/backend/src/issues/dto/create-issue.dto.ts @@ -1,4 +1,5 @@ import { + IsAlphanumeric, IsEnum, IsNumber, IsString, @@ -13,6 +14,12 @@ export class CreateIssueDto { @MaxLength(32) title: string; + @IsString() + @IsAlphanumeric() + @MinLength(3) + @MaxLength(16) + username: string; + @IsString() @MinLength(10) @MaxLength(255) diff --git a/apps/backend/src/issues/dto/update-issue.dto.ts b/apps/backend/src/issues/dto/update-issue.dto.ts index e4e242d..d179d27 100644 --- a/apps/backend/src/issues/dto/update-issue.dto.ts +++ b/apps/backend/src/issues/dto/update-issue.dto.ts @@ -2,5 +2,5 @@ import { OmitType, PartialType } from '@nestjs/mapped-types'; import { CreateIssueDto } from './create-issue.dto'; export class UpdateIssueDto extends PartialType( - OmitType(CreateIssueDto, ['type']), + OmitType(CreateIssueDto, ['type', 'username']), ) {} diff --git a/apps/backend/src/issues/entities/issue-comment.entity.ts b/apps/backend/src/issues/entities/issue-comment.entity.ts index 62c3fac..1463006 100644 --- a/apps/backend/src/issues/entities/issue-comment.entity.ts +++ b/apps/backend/src/issues/entities/issue-comment.entity.ts @@ -12,6 +12,9 @@ export class IssueComment { @PrimaryGeneratedColumn('uuid') id: string; + @Column() + username: string; + @ManyToOne(() => Issue, { onDelete: 'CASCADE', lazy: true }) issue: Promise; @@ -24,6 +27,7 @@ export class IssueComment { toDto() { return { content: this.content, + username: this.username, createdAt: this.createdAt.toISOString(), }; } diff --git a/apps/backend/src/issues/entities/issue.entity.ts b/apps/backend/src/issues/entities/issue.entity.ts index 556b94e..c830287 100644 --- a/apps/backend/src/issues/entities/issue.entity.ts +++ b/apps/backend/src/issues/entities/issue.entity.ts @@ -15,6 +15,9 @@ export class Issue { @Column() title: string; + @Column() + username: string; + @Column() description: string; @@ -36,6 +39,7 @@ export class Issue { toDto() { return { id: this.id, + username: this.username, title: this.title, type: this.type, status: this.status,