feat: add project DTOs
This commit is contained in:
@@ -0,0 +1,40 @@
|
|||||||
|
import { ApiProperty } from "@nestjs/swagger";
|
||||||
|
import { IsString, IsOptional, IsNotEmpty, IsUUID, IsDateString, MaxLength } from "class-validator";
|
||||||
|
|
||||||
|
export class CreateProjectDto {
|
||||||
|
@ApiProperty({ description: "Name of the project", example: "Mobile App Redesign" })
|
||||||
|
@IsString()
|
||||||
|
@IsNotEmpty()
|
||||||
|
@MaxLength(150)
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: "Name of the project owner", example: "Jane Doe" })
|
||||||
|
@IsString()
|
||||||
|
@IsNotEmpty()
|
||||||
|
@MaxLength(150)
|
||||||
|
ownerName: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: "Description of the project", required: false, example: "Redesign of the mobile app UI/UX" })
|
||||||
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
description?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: "Start date of the project", example: "2026-07-01" })
|
||||||
|
@IsDateString()
|
||||||
|
@IsNotEmpty()
|
||||||
|
startDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: "Background picture URL of the project",
|
||||||
|
required: false,
|
||||||
|
example: "https://cdn.example.com/projects/bg1.png",
|
||||||
|
})
|
||||||
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
backgroundPicture?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: "ID of the workspace this project belongs to", example: "a1b2c3d4-e5f6-7890-abcd-ef1234567890" })
|
||||||
|
@IsUUID()
|
||||||
|
@IsNotEmpty()
|
||||||
|
workspaceId: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import { PartialType } from '@nestjs/swagger';
|
||||||
|
import { CreateProjectDto } from './create-project.dto';
|
||||||
|
|
||||||
|
export class UpdateProjectDto extends PartialType(CreateProjectDto) {}
|
||||||
@@ -17,6 +17,9 @@ export class TMProject extends BaseEntity {
|
|||||||
@Column({ type: "timestamptz", nullable: true })
|
@Column({ type: "timestamptz", nullable: true })
|
||||||
startDate: Date;
|
startDate: Date;
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
backgroundPicture: string;
|
||||||
|
|
||||||
// --- Relations ---
|
// --- Relations ---
|
||||||
|
|
||||||
@ManyToOne(() => TMWorkspace, (workspace) => workspace.projects, {
|
@ManyToOne(() => TMWorkspace, (workspace) => workspace.projects, {
|
||||||
|
|||||||
Reference in New Issue
Block a user