Skip to content

M0-3b — DB-backed SpotService reads (fail-fast) #223

Description

@kylejb

Epic: #198 (E1)

Wire the running app to read from Postgres instead of the in-memory seed + live NDBC. Depends on #210 (ingestion populating observations).

Scope

  • cmd/api: build a pgx pool + store.New from env.GetString("DATABASE_URL"); fail fast if unset/unreachable (the app is DB-backed).
  • SpotService (internal/http/spot.go): read spots via store.ListSpots/GetSpot and latest conditions via store.LatestObservation — instead of spot.All()/spot.ByID() + live noaa.Realtime.
  • Map store.Observation → proto Conditions (mirroring the current toProtoConditions).

Acceptance

  • cmd/api requires DATABASE_URL; refuses to start without a reachable DB
  • GetSpot/ListSpots return DB-backed data; latest observation comes from observations
  • handler tests updated (stub store)

Split from #210.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureRequest for new functionality

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions