feat: implement API handlers for MVP endpoints (Task 5)
- Create cmd/api/handlers.go with HTTP handlers for all MVP endpoints
- Implement GET /v1/cities?query= city autocomplete
- Implement GET /v1/cities/{id}/stations city stations including neighbors
- Implement POST /v1/routes/search route search with Pareto-optimal results
- Implement GET /v1/routes/{search_id}/{route_id}/geojson route geometry
- Implement GET /v1/stations/{id}/status station status endpoint
- Add handler tests with success and error cases
- All existing tests pass
This commit is contained in:
@@ -93,15 +93,15 @@ Implement the Minimum Viable Product for the multimodal trip planning service, f
|
||||
- [x] Run tests - must pass before task 5
|
||||
|
||||
### Task 5: Implement API handlers for MVP endpoints
|
||||
- [ ] Create `cmd/api/handlers.go` with HTTP handlers
|
||||
- [ ] Implement `GET /v1/cities?query=` - city autocomplete from cached directory
|
||||
- [ ] Implement `GET /v1/cities/{id}/stations` - city stations including neighbors if main closed
|
||||
- [ ] Implement `POST /v1/routes/search` - body: from_city_id, to_city_id, date; response: Pareto-optimal routes (time, transfers)
|
||||
- [ ] Implement `GET /v1/routes/{search_id}/{route_id}/geojson` - geometry for map visualization
|
||||
- [ ] Implement `GET /v1/stations/{id}/status` - current station status
|
||||
- [ ] Write handlers tests (success cases, error cases, input validation)
|
||||
- [ ] Write integration tests (handler → cache → routing → API client flow)
|
||||
- [ ] Run tests - must pass before task 6
|
||||
- [x] Create `cmd/api/handlers.go` with HTTP handlers
|
||||
- [x] Implement `GET /v1/cities?query=` - city autocomplete from cached directory
|
||||
- [x] Implement `GET /v1/cities/{id}/stations` - city stations including neighbors if main closed
|
||||
- [x] Implement `POST /v1/routes/search` - body: from_city_id, to_city_id, date; response: Pareto-optimal routes (time, transfers)
|
||||
- [x] Implement `GET /v1/routes/{search_id}/{route_id}/geojson` - geometry for map visualization
|
||||
- [x] Implement `GET /v1/stations/{id}/status` - current station status
|
||||
- [x] Write handlers tests (success cases, error cases, input validation)
|
||||
- [x] Write integration tests (handler → cache → routing → API client flow)
|
||||
- [x] Run tests - must pass before task 6
|
||||
|
||||
### Task 6: Implement cron job for station status detection
|
||||
- [ ] Create `cmd/cron/station_status.go` daily cron job
|
||||
|
||||
Reference in New Issue
Block a user