feat(CRIT-010): add oil_prices API endpoint with zone-to-county mapping

Add GET /oil-prices/county/:county_id public endpoint to serve scraped
oil price data by county. Includes oil_prices table definition in schema
and a backfill script to populate county_id on existing records.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-09 18:31:38 -05:00
parent caa318508b
commit 85bbe43192
6 changed files with 134 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ use crate::auth::auth::{auth_middleware, login, register, logout};
use crate::data::data::get_user;
use crate::state::data::{get_counties_by_state, get_county_by_id};
use crate::listing::data::{get_listings, get_listing_by_id, get_listings_by_county, create_listing, update_listing, delete_listing};
use crate::oil_prices::data::get_oil_prices_by_county;
use axum::middleware;
use sqlx::PgPool;
use std::sync::Arc;
@@ -18,6 +19,7 @@ mod data;
mod state;
mod company;
mod listing;
mod oil_prices;
#[tokio::main]
async fn main() {
@@ -82,7 +84,8 @@ async fn main() {
.route("/categories", axum::routing::get(crate::company::category::get_all_categories))
.route("/state/:state_abbr", axum::routing::get(get_counties_by_state))
.route("/state/:state_abbr/:county_id", axum::routing::get(get_county_by_id))
.route("/listings/county/:county_id", axum::routing::get(get_listings_by_county));
.route("/listings/county/:county_id", axum::routing::get(get_listings_by_county))
.route("/oil-prices/county/:county_id", axum::routing::get(get_oil_prices_by_county));
let app = public_routes
.merge(protected_routes)