add username to issue

This commit is contained in:
mmacierzanka committed 2023-05-26 23:01:16 +02:00
1 parent 0f8bc2add1
commit 3fa8c54fe9
5 files changed
+21 -1

No files matched your search

@@ -1,6 +1,11 @@
import { IsString, MaxLength, MinLength } from 'class-validator'; import { IsString, MaxLength, MinLength } from 'class-validator';
export class CreateIssueCommentDto { export class CreateIssueCommentDto {
@IsString()
@MinLength(3)
@MaxLength(16)
username: string;
@IsString() @IsString()
@MinLength(1) @MinLength(1)
@MaxLength(255) @MaxLength(255)
@@ -1,4 +1,5 @@
import { import {
IsAlphanumeric,
IsEnum, IsEnum,
IsNumber, IsNumber,
IsString, IsString,
@@ -13,6 +14,12 @@ export class CreateIssueDto {
@MaxLength(32) @MaxLength(32)
title: string; title: string;
@IsString()
@IsAlphanumeric()
@MinLength(3)
@MaxLength(16)
username: string;
@IsString() @IsString()
@MinLength(10) @MinLength(10)
@MaxLength(255) @MaxLength(255)
@@ -2,5 +2,5 @@ import { OmitType, PartialType } from '@nestjs/mapped-types';
import { CreateIssueDto } from './create-issue.dto'; import { CreateIssueDto } from './create-issue.dto';
export class UpdateIssueDto extends PartialType( export class UpdateIssueDto extends PartialType(
OmitType(CreateIssueDto, ['type']), OmitType(CreateIssueDto, ['type', 'username']),
) {} ) {}
@@ -12,6 +12,9 @@ export class IssueComment {
@PrimaryGeneratedColumn('uuid') @PrimaryGeneratedColumn('uuid')
id: string; id: string;
@Column()
username: string;
@ManyToOne(() => Issue, { onDelete: 'CASCADE', lazy: true }) @ManyToOne(() => Issue, { onDelete: 'CASCADE', lazy: true })
issue: Promise<Issue>; issue: Promise<Issue>;
@@ -24,6 +27,7 @@ export class IssueComment {
toDto() { toDto() {
return { return {
content: this.content, content: this.content,
username: this.username,
createdAt: this.createdAt.toISOString(), createdAt: this.createdAt.toISOString(),
}; };
} }
@@ -15,6 +15,9 @@ export class Issue {
@Column() @Column()
title: string; title: string;
@Column()
username: string;
@Column() @Column()
description: string; description: string;
@@ -36,6 +39,7 @@ export class Issue {
toDto() { toDto() {
return { return {
id: this.id, id: this.id,
username: this.username,
title: this.title, title: this.title,
type: this.type, type: this.type,
status: this.status, status: this.status,