• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rm-hull / fuel-prices-api / 22042020363

15 Feb 2026 07:53PM UTC coverage: 0.0%. Remained the same
22042020363

push

github

web-flow
feat: add REST API server and search endpoint (#3)

* feat: add REST API server and search endpoint

Introduces a RESTful API using the `gin` framework and refactors the
application entry point to use `cobra` CLI commands.

*   Implemented `GET /v1/fuel-prices/search` with **bounding box**
    validation.
*   Added `api-server` subcommand to manage service startup.
*   Integrated middleware for `prometheus` metrics, `pprof` profiling,
    `CORS`, and automated health checks.
*   Enabled `HEALTHCHECK` in the `Dockerfile` for container monitoring.
*   Updated data models to include metadata like `attribution` and
    `last_updated` timestamps.

```mermaid
sequenceDiagram
    participant C as Client
    participant A as API (Gin)
    participant R as Repository
    participant F as FuelClient

    C->>A: GET /search?bbox=min_lon,min_lat,max_lon,max_lat
    A->>A: Parse & validate BBox
    alt Invalid BBox
        A-->>C: 400 Bad Request
    else Valid BBox
        A->>R: Search(bbox)
        R-->>A: List of results
        A->>F: LastUpdated()
        F-->>A: Timestamp
        A-->>C: 200 OK (Results + Attribution + UpdatedTime)
    end
```

* fix: improve bounding box validation accuracy

Update `parseBBox` to calculate physical distance in meters rather
than comparing raw degree differences.

- Accounts for longitude shrinkage at higher latitudes using the
  cosine of the average latitude.
- Ensures `MAX_BOUNDS` correctly limits the geographic area in
  physical units.

* go mod tidy

0 of 126 new or added lines in 4 files covered. (0.0%)

0 of 573 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/cmd/api_server.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc