Add complete API integration for ProjectManagement module: - Epics, Stories, Tasks API clients - React Query hooks for all entities - Updated type definitions to match backend API - API test page for connection verification Changes: - Update lib/api/config.ts: Add all ProjectManagement endpoints - Update types/project.ts: Match backend API models (Epic, Story, Task) - Create lib/api/pm.ts: API clients for Epics, Stories, Tasks - Create lib/hooks/use-epics.ts: React Query hooks for Epic CRUD - Create lib/hooks/use-stories.ts: React Query hooks for Story CRUD - Create lib/hooks/use-tasks.ts: React Query hooks for Task CRUD - Create app/(dashboard)/api-test/page.tsx: API connection test page Features: - Full CRUD operations for Epics, Stories, Tasks - Status change and assignment operations - Optimistic updates for better UX - Error handling with toast notifications - Query invalidation for cache consistency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
130 lines
2.8 KiB
TypeScript
130 lines
2.8 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;
|
|
title: string;
|
|
description?: string;
|
|
projectId: string;
|
|
status: WorkItemStatus;
|
|
priority: WorkItemPriority;
|
|
estimatedHours?: number;
|
|
actualHours?: number;
|
|
assigneeId?: string;
|
|
tenantId: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface CreateEpicDto {
|
|
projectId: string;
|
|
title: string;
|
|
description?: string;
|
|
priority: WorkItemPriority;
|
|
estimatedHours?: number;
|
|
}
|
|
|
|
export interface UpdateEpicDto {
|
|
title?: string;
|
|
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;
|