fix: Food Queue Migration Failure and Volunteer Access Restriction
Two backend issues were identified in the Food Queue module:
-
The
db-initcontainer failed during Alembic migration because the migration attempted to drop indexes/tables that did not exist in certain database states. -
Volunteers were denied access to Food Queue related APIs because some endpoints were restricted to admin-only roles.
To Reproduce
Migration Failure
- Start backend services
- Run database migrations
- Observe
db-initcontainer logs - Migration fails with missing index/table errors
Volunteer Access Restriction
- Login as volunteer user
- Navigate to Food Queue
- Trigger Food Queue related API
- Observe access denied response
Expected behavior
- Database migrations should complete successfully even if indexes/tables are already missing.
- Volunteers and coordinators should be able to access required Food Queue APIs without authorization errors.
Screenshots
If applicable, add screenshots/logs showing:
-
db-initmigration failure Access denied. Required role(s): admin
Environment
- OS: Ubuntu Linux
- Browser: Firefox
- Backend: FastAPI
- Database: PostgreSQL
- Migration Tool: Alembic
Additional context
Root cause for migration issue:
- Alembic migration assumed Food Queue indexes/tables always existed.
Root cause for access issue:
- RBAC configuration allowed only admin role for endpoints that should also support volunteer/coordinator roles.
Fix implemented:
- Added
DROP INDEX IF EXISTS - Added
DROP TABLE IF EXISTS - Updated backend role access configuration for Food Queue related APIs
Validation passed successfully:
uv run pytest tests/test_api/test_stations_routes.py tests/test_api/test_patient_routes.py -q
Result:
53 passed