feat(food-queue): implement food queue workflow
Merge Request
Overview
This MR integrates Food Queue into the frontend queue workflow and synchronizes UI behavior with the updated backend queue transition logic.
The goal is to ensure that patients move into Food Queue after vitals completion and only proceed to consultation after Food Queue completion or skip.
What does this MR do and why?
Previously, frontend queue flow assumed:
Vitals → Consultation
This no longer matched backend behavior after Food Queue integration.
Frontend also had API integration issues including:
- Wrong endpoint usage
- Undefined IDs during Complete/Skip
- Redirect-based API calls (307)
- Queue state synchronization issues
This MR updates frontend queue behavior to align with backend Food Queue workflow.
Updated flow:
Registration → Vitals Waiting → Vitals → Food Queue → Consultation
Approach:
- Integrate Food Queue into existing queue UI
- Connect frontend with Food Queue backend APIs
- Fix Complete/Skip actions
- Update queue state and dashboard synchronization
- Preserve existing medicine and counselling workflows
Changes Made
Food Queue Frontend Integration
Modified / Added:
- Food Queue page/component
- Food Queue API service
- Dashboard / Medical Camp Map
- Queue state synchronization logic
- Translation keys and error handling
Key Changes
- Integrated Food Queue into queue UI
- Connected frontend with backend Food Queue APIs
- Fixed Complete/Skip API calls
- Fixed undefined ID issue
- Fixed API endpoint routing mismatch
- Updated queue refresh and dashboard counts
- Added loading and error handling
- Improved i18n coverage
Technical Details
Root Cause
Frontend still followed old queue assumptions:
Vitals → Consultation
and incorrectly called:
/queue/undefined/complete
This caused:
- 404 errors
- Failed Complete/Skip actions
- Queue mismatch
- UI state inconsistencies
Additionally, Food Queue requests triggered:
307 redirect
due to endpoint mismatch.
Fix
Frontend now uses backend Food Queue endpoints directly:
GET /api/v1/food-queue
POST /api/v1/food-queue/add
PATCH /api/v1/food-queue/{id}/complete
PATCH /api/v1/food-queue/{id}/skip
Queue refresh and dashboard synchronization now follow backend queue state.
After vitals save:
queue_status = food
After Complete/Skip:
queue_status = waiting / consultation
Type of Change
-
🐛 Bug fix (non-breaking change that fixes an issue) -
✨ New feature (non-breaking change that adds functionality) -
💥 Breaking change -
📝 Documentation update -
🎨 UI/UX improvement -
♻ ️ Refactor -
⚡ Performance improvement -
🧪 Test update -
🔧 Configuration change -
🚨 Security fix
Related Issues / References
- Closes Food Queue frontend integration issue
- Related to backend Food Queue workflow MR
Screenshots or Screen Recordings
| Before |
|---|
| Vitals → Consultation |
| Food Queue unavailable |
| Complete/Skip failing |
|After |
| Vitals → Food Queue → Consultation |
| Food Queue visible and functional|
| Complete/Skip functional|
How to Set Up and Validate Locally
-
Pull branch
-
Install dependencies:
bun install
-
Ensure backend Food Queue APIs are running.
-
Start frontend:
bun dev
- Navigate to:
Volunteer Dashboard
- Test flow:
- Register patient
- Move to vitals
- Save vitals
- Verify Food Queue updates
- Complete or Skip Food Queue
- Verify consultation progression
Expected behavior:
Vitals → Food Queue → Consultation
Testing Done
-
Manual testing completed -
Unit tests added/updated
Test Cases Covered
| Scenario | Expected Result | Status |
|---|---|---|
| Save vitals | Patient appears in Food Queue | |
| Food Queue fetch | Queue data loads successfully | |
| Complete Food | Moves to consultation | |
| Skip Food | Moves to consultation | |
| Dashboard counts | Sync with backend | |
| No undefined IDs | API calls succeed |
Code Quality Checklist
Code Standards
-
Code follows project conventions -
No debug statements left -
No duplicate logic -
TypeScript types maintained -
ESLint checks pass
React Best Practices
-
Components remain modular -
Hooks follow React rules -
State management maintained -
Loading and refresh handled
Component Patterns
-
Existing UI patterns reused -
Tailwind styling preserved -
Queue UI consistency maintained -
Lucide icons used consistently
API & Data Fetching
-
Loading states handled -
Error states handled -
Axios integration maintained -
Food Queue API integrated
Error Handling
-
API failures handled -
Toast messages supported -
User-friendly errors displayed
Documentation
-
README updated -
.env updated -
CHANGELOG updated
Known Limitations / Technical Debt
- Depends on backend Food Queue transition logic
- Dashboard synchronization depends on API refresh timing
Additional Notes
This MR aligns frontend queue behavior with the backend Food Queue lifecycle.
Frontend now correctly reflects:
Vitals → Food Queue → Consultation
and removes previous API routing and state synchronization issues.
MR Acceptance Checklist
Frontend Food Queue integration validated against backend queue behavior and existing queue workflows.