- 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
- Create cmd/cron/station_status.go with daily station status checking
- Implement schedule querying via Yandex API with rate limiting and circuit breaker
- Closure detection: N consecutive days of zero trips (N=3) → closed status
- Reactivation: active status when trips resume after being closed
- Add tests for cron logic: status transition, zero-flight detection, reactivation
- All tests pass: go test ./cmd/cron/ and go test ./...
This commit implements the core routing functionality for the trip planner MVP:
1. API handlers for city autocomplete, station listing, route search, and route GeoJSON
2. Router integration with Yandex Schedules API for building routing graphs
3. Pareto-optimal route search with max 1 transfer and MCT filtering
4. Cron job for station status detection and closure monitoring
5. Circuit breaker and rate limiter integration in Yandex client
6. Redis cache-aside layer for city directories and station lists
Co-Authored-By: Claude <noreply@anthropic.com>
Mrixs
self-assigned this 2026-08-14 10:17:36 +00:00
Mrixs
merged commit d10dbf37f4 into master2026-08-14 10:17:49 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
- Created cache/store.go with Cache interface, redisClient wrapper, cacheStore, TTL constants (CityTTL 30d, SearchNearTermTTL 3h, SearchFarTermTTL 7d) - Implemented cache keys: cities:{code}, stations:{id}, search:{from}:{to}:{date} - Implemented cache-aside pattern via CacheAside struct with GetOrSetFuncPattern, GetCity, GetStation, GetSearch - Added TTL-aware search result caching with near-term (3h) and far-term (7d) policies - Wrote 6 unit tests: CacheGetSet, CacheKeyString, CacheAsideGetOrSet, CacheAsideGetCity, CacheAsideGetSearch, CacheInvalidate - All tests pass with Redis integration- 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