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

rm-hull / fuel-prices-api / 23564552979
46%

Build:
DEFAULT BRANCH: main
Ran 25 Mar 2026 09:16PM UTC
Jobs 1
Files 23
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

25 Mar 2026 09:16PM UTC coverage: 27.025% (-1.6%) from 28.645%
23564552979

push

github

web-flow
feat: add price history endpoint and error handling (#39)

* feat: add price history endpoint and error handling

- Added `/v1/fuel-prices/history/:node_id/:fuel_type` endpoint.
- Implemented `PriceHistory` in the repository layer using a new SQL
  query.
- Added global `NoRoute` and `NoMethod` handlers to improve API
  consistency.

```mermaid
sequenceDiagram
    participant C as Client
    participant A as API Server
    participant R as Repository
    participant DB as SQLite

    C->>A: GET /history/:node_id/:fuel_type
    A->>R: PriceHistory(node_id, fuel_type)
    R->>DB: Query price_history.sql
    DB-->>R: Returns price rows
    R-->>A: Returns []FuelPrice
    A-->>C: Returns PriceHistoryResponse (JSON)
```

* Update internal/sql/price_history.sql

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* feat: add validation for fuel types in route

- Add `FuelTypes` method to `FuelPricesRepository` with caching.
- Validate requested `fuel_type` against database records before
  querying price history.

```mermaid
sequenceDiagram
    participant User
    participant Router
    participant Repo
    participant DB

    User->>Router: GET /history/:node_id/:fuel_type
    Router->>Repo: FuelTypes()
    Repo->>DB: SELECT DISTINCT fuel_type...
    Repo-->>Router: map[string]struct{}
    alt fuel type exists
        Router->>Repo: PriceHistory(node_id, fuel_type)
        Router-->>User: 200 OK
    else fuel type missing
        Router-->>User: 400 Bad Request
    end
```

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

0 of 81 new or added lines in 3 files covered. (0.0%)

387 of 1432 relevant lines covered (27.03%)

0.29 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
7
0.0
0.0% cmd/api_server.go
28
0.0
internal/routes/price_history.go
46
60.6
-9.65% internal/repository.go
Jobs
ID Job ID Ran Files Coverage
1 23564552979.1 25 Mar 2026 09:16PM UTC 23
27.03
GitHub Action Run
Source Files on build 23564552979
  • Tree
  • List 23
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • bc7f6e57 on github
  • Prev Build on main (#23451908461)
  • Next Build on main (#23565053187)
  • Delete
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