Fix frontend-backend API field mismatches for Epic entity by: 1. Changed Epic.title to Epic.name in type definitions 2. Added Epic.createdBy field (required by backend) 3. Updated all Epic references from epic.title to epic.name 4. Fixed Epic form to use name field and include createdBy Files modified: - types/project.ts: Updated Epic, CreateEpicDto, UpdateEpicDto interfaces - components/epics/epic-form.tsx: Fixed defaultValues to use epic.name - components/projects/hierarchy-tree.tsx: Replaced epic.title with epic.name - components/projects/story-form.tsx: Fixed epic dropdown to show epic.name - app/(dashboard)/projects/[id]/epics/page.tsx: Display epic.name in list - app/(dashboard)/projects/[id]/page.tsx: Display epic.name in preview - app/(dashboard)/api-test/page.tsx: Display epic.name in test page This resolves the 400 Bad Request error when creating Epics caused by missing 'Name' field (was sending 'title' instead) and missing 'CreatedBy' field. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
132 lines
3.0 KiB
TypeScript
132 lines
3.0 KiB
TypeScript
// ==================== Common Types ====================
|
|
export type WorkItemStatus = 'Backlog' | 'Todo' | 'InProgress' | 'Done';
|
|
export type WorkItemPriority = 'Low' | 'Medium' | 'High' | 'Critical';
|
|
|
|
// ==================== Project ====================
|
|
export interface Project {
|
|
id: string;
|
|
name: string;
|
|
key: string;
|
|
description?: string;
|
|
tenantId: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface CreateProjectDto {
|
|
name: string;
|
|
key: string;
|
|
description?: string;
|
|
}
|
|
|
|
export interface UpdateProjectDto {
|
|
name: string;
|
|
key: string;
|
|
description?: string;
|
|
}
|
|
|
|
// ==================== Epic ====================
|
|
export interface Epic {
|
|
id: string;
|
|
name: string; // Changed from 'title' to match backend API
|
|
description?: string;
|
|
projectId: string;
|
|
status: WorkItemStatus;
|
|
priority: WorkItemPriority;
|
|
estimatedHours?: number;
|
|
actualHours?: number;
|
|
assigneeId?: string;
|
|
createdBy: string; // Added to match backend API (required field)
|
|
tenantId: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface CreateEpicDto {
|
|
projectId: string;
|
|
name: string; // Changed from 'title' to match backend API
|
|
description?: string;
|
|
priority: WorkItemPriority;
|
|
estimatedHours?: number;
|
|
createdBy: string; // Added to match backend API (required field)
|
|
}
|
|
|
|
export interface UpdateEpicDto {
|
|
name?: string; // Changed from 'title' to match backend API
|
|
description?: string;
|
|
priority?: WorkItemPriority;
|
|
estimatedHours?: number;
|
|
actualHours?: number;
|
|
}
|
|
|
|
// ==================== Story ====================
|
|
export interface Story {
|
|
id: string;
|
|
title: string;
|
|
description?: string;
|
|
epicId: string;
|
|
projectId: string;
|
|
status: WorkItemStatus;
|
|
priority: WorkItemPriority;
|
|
estimatedHours?: number;
|
|
actualHours?: number;
|
|
assigneeId?: string;
|
|
tenantId: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface CreateStoryDto {
|
|
epicId: string;
|
|
title: string;
|
|
description?: string;
|
|
priority: WorkItemPriority;
|
|
estimatedHours?: number;
|
|
}
|
|
|
|
export interface UpdateStoryDto {
|
|
title?: string;
|
|
description?: string;
|
|
priority?: WorkItemPriority;
|
|
estimatedHours?: number;
|
|
actualHours?: number;
|
|
}
|
|
|
|
// ==================== Task ====================
|
|
export interface Task {
|
|
id: string;
|
|
title: string;
|
|
description?: string;
|
|
storyId: string;
|
|
projectId: string;
|
|
status: WorkItemStatus;
|
|
priority: WorkItemPriority;
|
|
estimatedHours?: number;
|
|
actualHours?: number;
|
|
assigneeId?: string;
|
|
tenantId: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface CreateTaskDto {
|
|
storyId: string;
|
|
title: string;
|
|
description?: string;
|
|
priority: WorkItemPriority;
|
|
estimatedHours?: number;
|
|
}
|
|
|
|
export interface UpdateTaskDto {
|
|
title?: string;
|
|
description?: string;
|
|
priority?: WorkItemPriority;
|
|
estimatedHours?: number;
|
|
actualHours?: number;
|
|
}
|
|
|
|
// ==================== Legacy Types (for backward compatibility) ====================
|
|
// Keep old type names as aliases for gradual migration
|
|
export type TaskStatus = WorkItemStatus;
|
|
export type TaskPriority = WorkItemPriority;
|