Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
4.2 KiB
Controller Migration Analysis
Summary
This analysis identifies all controllers that extend from BaseController (not ApiBaseController) and checks if they have V2 replacements.
V2 Controllers (Already Migrated)
These controllers have been migrated to V2 and extend ApiBaseControllerV2:
- ApiCompanyControllerV2 - Companies management
- ApiContactControllerV2 - Contacts management ✅ (routes using V2)
- ApiPermissionControllerV2 - Permissions management
- ApiProjectControllerV2 - Projects management ✅ (routes using V2)
- ApiRoleControllerV2 - Roles management
- ApiTeamControllerV2 - Teams management ✅ (routes using V2)
- ApiTicketControllerV2 - Tickets management
- ApiTimeEntryControllerV2 - Time entries management
- ApiUserControllerV2 - Users management ✅ (routes using V2)
Non-V2 Controllers (Need Migration)
These controllers still extend BaseController and do NOT have V2 versions:
-
AssetController - Asset management
- Routes:
/api/v1/assets/* - Status: Still using old controller
- Routes:
-
AutomationController - Automation rules and executions
- Routes:
/api/v1/automation/* - Status: Still using old controller
- Routes:
-
ContractLineController - Contract Lines management
- Routes:
/api/v1/contract-lines/* - Status: Still using old controller
- Routes:
-
CategoryController - Category management (tickets/services)
- Routes:
/api/v1/categories/* - Status: Still using old controller
- Routes:
-
FinancialController - Financial operations (credits, transactions, reports)
- Routes:
/api/v1/financial/* - Status: Still using old controller
- Routes:
-
InvoiceController - Invoice management
- Routes:
/api/v1/invoices/* - Status: Still using old controller
- Routes:
-
MetadataController - API metadata and documentation
- Routes:
/api/v1/meta/* - Status: Still using old controller
- Routes:
-
PermissionRoleController - Permission role management
- Routes:
/api/v1/roles/*,/api/v1/permissions/* - Status: Still using old controller
- Routes:
-
QuickBooksController - QuickBooks integration
- Routes:
/api/v1/integrations/quickbooks/* - Status: Still using old controller
- Routes:
-
TagController - Tag management
- Routes:
/api/v1/tags/* - Status: Still using old controller
- Routes:
-
TimeSheetController - Time sheet management
- Routes:
/api/v1/time-sheets/* - Status: Still using old controller
- Routes:
-
WebhookController - Webhook management
- Routes:
/api/v1/webhooks/* - Status: Still using old controller
- Routes:
-
WorkflowController - Workflow management
- Routes:
/api/v1/workflows/* - Status: Still using old controller
- Routes:
Migration Priority
Based on usage patterns and complexity:
High Priority
- TagController - Widely used across the system
- AssetController - Core business entity
- InvoiceController - Critical for billing
- TimeSheetController - Related to time tracking
Medium Priority
- CategoryController - Used for organization
- FinancialController - Complex but isolated
- WebhookController - Integration point
- WorkflowController - Advanced feature
Low Priority
- AutomationController - Advanced feature
- ContractLineController - Configuration-focused
- MetadataController - API documentation
- PermissionRoleController - Admin feature
- QuickBooksController - External integration
Key Differences: BaseController vs ApiBaseControllerV2
- BaseController: Uses basic CRUD patterns with simple middleware composition
- ApiBaseControllerV2: Provides enhanced features including:
- Built-in pagination with metadata
- Standardized error handling
- Request/response validation
- Automatic HATEOAS link generation
- Better TypeScript support
- Consistent API response format
Recommendation
Start migrating controllers in the priority order listed above. Each migration should:
- Create a new V2 controller extending
ApiBaseControllerV2 - Update the corresponding service if needed
- Update all routes to use the new V2 controller
- Add proper TypeScript types and validation schemas
- Update tests to match the new API format