feat(frontend): Implement Phase 1 - ProjectManagement API Client & Hooks
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>
This commit is contained in:
109
types/project.ts
109
types/project.ts
@@ -1,90 +1,129 @@
|
||||
export type ProjectStatus = 'Active' | 'Archived' | 'OnHold';
|
||||
// ==================== Common Types ====================
|
||||
export type WorkItemStatus = 'Backlog' | 'Todo' | 'InProgress' | 'Done';
|
||||
export type WorkItemPriority = 'Low' | 'Medium' | 'High' | 'Critical';
|
||||
|
||||
// ==================== Project ====================
|
||||
export interface Project {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
key: string;
|
||||
status: ProjectStatus;
|
||||
ownerId: string;
|
||||
description?: string;
|
||||
tenantId: string;
|
||||
createdAt: string;
|
||||
updatedAt?: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface CreateProjectDto {
|
||||
name: string;
|
||||
description: string;
|
||||
key: string;
|
||||
ownerId?: string; // Optional in form, will be set automatically
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface UpdateProjectDto {
|
||||
name?: string;
|
||||
name: string;
|
||||
key: string;
|
||||
description?: string;
|
||||
status?: ProjectStatus;
|
||||
}
|
||||
|
||||
// ==================== Epic ====================
|
||||
export interface Epic {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
title: string;
|
||||
description?: string;
|
||||
projectId: string;
|
||||
status: TaskStatus;
|
||||
priority: TaskPriority;
|
||||
status: WorkItemStatus;
|
||||
priority: WorkItemPriority;
|
||||
estimatedHours?: number;
|
||||
actualHours?: number;
|
||||
assigneeId?: string;
|
||||
tenantId: string;
|
||||
createdAt: string;
|
||||
createdBy: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export type TaskStatus = 'ToDo' | 'InProgress' | 'InReview' | 'Done' | 'Blocked';
|
||||
export type TaskPriority = 'Low' | 'Medium' | 'High' | 'Urgent';
|
||||
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;
|
||||
description?: string;
|
||||
epicId: string;
|
||||
status: TaskStatus;
|
||||
priority: TaskPriority;
|
||||
projectId: string;
|
||||
status: WorkItemStatus;
|
||||
priority: WorkItemPriority;
|
||||
estimatedHours?: number;
|
||||
actualHours?: number;
|
||||
assigneeId?: string;
|
||||
createdBy: string;
|
||||
tenantId: string;
|
||||
createdAt: string;
|
||||
updatedAt?: 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;
|
||||
description?: string;
|
||||
storyId: string;
|
||||
status: TaskStatus;
|
||||
priority: TaskPriority;
|
||||
projectId: string;
|
||||
status: WorkItemStatus;
|
||||
priority: WorkItemPriority;
|
||||
estimatedHours?: number;
|
||||
actualHours?: number;
|
||||
assigneeId?: string;
|
||||
customFields?: Record<string, any>;
|
||||
createdBy: string;
|
||||
tenantId: string;
|
||||
createdAt: string;
|
||||
updatedAt?: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface CreateTaskDto {
|
||||
title: string;
|
||||
description: string;
|
||||
storyId: string;
|
||||
priority: TaskPriority;
|
||||
title: string;
|
||||
description?: string;
|
||||
priority: WorkItemPriority;
|
||||
estimatedHours?: number;
|
||||
assigneeId?: string;
|
||||
}
|
||||
|
||||
export interface UpdateTaskDto {
|
||||
title?: string;
|
||||
description?: string;
|
||||
status?: TaskStatus;
|
||||
priority?: TaskPriority;
|
||||
priority?: WorkItemPriority;
|
||||
estimatedHours?: number;
|
||||
actualHours?: number;
|
||||
assigneeId?: string;
|
||||
customFields?: Record<string, any>;
|
||||
}
|
||||
|
||||
// ==================== Legacy Types (for backward compatibility) ====================
|
||||
// Keep old type names as aliases for gradual migration
|
||||
export type TaskStatus = WorkItemStatus;
|
||||
export type TaskPriority = WorkItemPriority;
|
||||
|
||||
Reference in New Issue
Block a user