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';
export class CreateIssueCommentDto {
@IsString()
@MinLength(3)
@MaxLength(16)
username: string;
@IsString()
@MinLength(1)
@MaxLength(255)
@@ -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)
@@ -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']),
) {}
@@ -12,6 +12,9 @@ export class IssueComment {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column()
username: string;
@ManyToOne(() => Issue, { onDelete: 'CASCADE', lazy: true })
issue: Promise<Issue>;
@@ -24,6 +27,7 @@ export class IssueComment {
toDto() {
return {
content: this.content,
username: this.username,
createdAt: this.createdAt.toISOString(),
};
}
@@ -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,