Address all Critical and High Priority issues identified in frontend code review report: Critical Issues Fixed: - Created unified logger utility (lib/utils/logger.ts) to replace all console.log statements - Consolidated User type definitions - removed duplicate from authStore, using single source from types/user.ts - Eliminated 'any' types in API client - added proper generic types with AxiosRequestConfig - Fixed SignalR ConnectionManager - replaced 'any' with generic types <T> - Created API error types (lib/types/errors.ts) with ApiError and getErrorMessage helper - Fixed IssueCard component - removed all type assertions, created discriminated union types for Kanban items - Added React.memo to IssueCard for performance optimization - Added proper ARIA labels and accessibility attributes to IssueCard High Priority Issues Fixed: - Fixed hardcoded user ID in CreateProjectDialog - now uses actual user from authStore - Added useCallback to CreateProjectDialog onSubmit handler - Fixed error handlers in use-epics.ts - replaced 'any' with ApiError type - Updated all error handling to use logger and getErrorMessage Type Safety Improvements: - Created KanbanItem discriminated union (KanbanEpic | KanbanStory | KanbanTask) with proper type guards - Added 'never' types to prevent invalid property access - Fixed User interface to include all required fields (createdAt, updatedAt) - Maintained backward compatibility with LegacyKanbanBoard for existing code Files Changed: - lib/utils/logger.ts - New centralized logging utility - lib/types/errors.ts - New API error types and helpers - types/user.ts - Consolidated User type with TenantRole - types/kanban.ts - New discriminated union types for type-safe Kanban items - components/features/kanban/IssueCard.tsx - Type-safe with React.memo - components/features/projects/CreateProjectDialog.tsx - Fixed hardcoded user ID, added useCallback - lib/api/client.ts - Eliminated 'any', added proper generics - lib/signalr/ConnectionManager.ts - Replaced console.log, added generics - lib/hooks/use-epics.ts - Fixed error handler types - stores/authStore.ts - Removed duplicate User type - lib/hooks/useAuth.ts - Added createdAt field to User TypeScript compilation: ✅ All type checks passing (0 errors) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
134 lines
3.1 KiB
TypeScript
134 lines
3.1 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;
|
|
projectId: string;
|
|
title: string;
|
|
description?: string;
|
|
priority: WorkItemPriority;
|
|
estimatedHours?: number;
|
|
createdBy: string; // Required field matching backend API
|
|
}
|
|
|
|
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;
|