clqms-be/docs/V2_ROUTES_MIGRATION.md

161 lines
3.6 KiB
Markdown
Raw Normal View History

# V2 Routes Migration Summary
## Date: 2025-12-30
## Overview
All new UI views have been moved to the `/v2/` prefix to avoid conflicts with existing frontend engineer's work.
---
## Route Changes
### Before (Conflicting with existing work)
```
/ → Dashboard
/login → Login page
/patients → Patients list
/requests → Lab requests
/settings → Settings
```
### After (V2 namespace - No conflicts)
```
/v2/ → Dashboard
/v2/login → Login page
/v2/patients → Patients list
/v2/requests → Lab requests
/v2/settings → Settings
```
---
## Files Modified
### 1. Routes Configuration
**File:** `app/Config/Routes.php`
```php
// Public Routes
$routes->get('/v2/login', 'PagesController::login');
// Protected Page Routes - V2
$routes->group('v2', ['filter' => 'auth'], function ($routes) {
$routes->get('/', 'PagesController::dashboard');
$routes->get('dashboard', 'PagesController::dashboard');
$routes->get('patients', 'PagesController::patients');
$routes->get('requests', 'PagesController::requests');
$routes->get('settings', 'PagesController::settings');
});
```
### 2. Auth Filter
**File:** `app/Filters/AuthFilter.php`
- Redirects to `/v2/login` when unauthorized
### 3. Login Page
**File:** `app/Views/auth/login.php`
- Redirects to `/v2/` after successful login
### 4. Main Layout
**File:** `app/Views/layout/main_layout.php`
- All navigation links updated to `/v2/*`
- Logout redirects to `/v2/login`
### 5. Dashboard
**File:** `app/Views/dashboard/dashboard_index.php`
- Quick action links updated to `/v2/*`
---
## URL Mapping
| Feature | URL | Auth Required |
|---------|-----|---------------|
| **Login** | `/v2/login` | ❌ No |
| **Dashboard** | `/v2/` or `/v2/dashboard` | ✅ Yes |
| **Patients** | `/v2/patients` | ✅ Yes |
| **Lab Requests** | `/v2/requests` | ✅ Yes |
| **Settings** | `/v2/settings` | ✅ Yes |
---
## API Endpoints (Unchanged)
API routes remain the same - no `/v2/` prefix needed:
```
POST /api/auth/login
POST /api/auth/register
GET /api/auth/check
POST /api/auth/logout
GET /api/patient
POST /api/patient
...etc
```
---
## Testing URLs
### Development Server
```
Login: http://localhost:8080/v2/login
Dashboard: http://localhost:8080/v2/
Patients: http://localhost:8080/v2/patients
Requests: http://localhost:8080/v2/requests
Settings: http://localhost:8080/v2/settings
```
---
## Frontend Engineer's Work
**Protected:** All existing routes remain untouched
- Root `/` is available for frontend engineer
- `/patients`, `/requests`, etc. are available
- No conflicts with new V2 UI
---
## Migration Checklist
- [x] Updated routes to use `/v2/` prefix
- [x] Updated AuthFilter redirects
- [x] Updated login page redirect
- [x] Updated main layout navigation links
- [x] Updated dashboard quick action links
- [x] Updated logout redirect
- [x] API routes remain unchanged
- [x] Documentation created
---
## Notes for Team
1. **New UI is at `/v2/`** - Share this URL with testers
2. **Old routes are free** - Frontend engineer can use root paths
3. **API unchanged** - Both UIs can use the same API endpoints
4. **Auth works for both** - JWT authentication applies to both V1 and V2
---
## Future Considerations
When ready to migrate fully to V2:
1. Remove `/v2/` prefix from routes
2. Archive or remove old frontend files
3. Update documentation
4. Update any bookmarks/links
Or keep both versions running side-by-side if needed.
---
**Status:** ✅ Complete - No conflicts with existing work