feat: add admin panel, stats endpoint, and url field to listings
- Add full admin CRUD routes for users, companies, listings, oil-prices protected behind auth middleware (/admin/*) - Add public /stats endpoint returning latest market price aggregates - Add /health and / health check endpoints - Add `url` field to listings (struct, all SQL queries, create/update) - Add `phone` and `url` fields to OilPrice struct - Remove deprecated company CRUD handlers (get_company, create_company) - Update schema.sql; remove one-off alter/drop migration scripts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,7 @@ CREATE TABLE listings (
|
||||
online_ordering VARCHAR(20) NOT NULL DEFAULT 'none',
|
||||
county_id INTEGER NOT NULL,
|
||||
town VARCHAR(100),
|
||||
url VARCHAR(255),
|
||||
user_id INTEGER NOT NULL,
|
||||
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
last_edited TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP
|
||||
@@ -82,3 +83,10 @@ CREATE TABLE oil_prices (
|
||||
|
||||
-- If the table already exists, drop the company_id column
|
||||
-- ALTER TABLE listings DROP COLUMN company_id;
|
||||
|
||||
CREATE TABLE stats_prices (
|
||||
id SERIAL PRIMARY KEY,
|
||||
state VARCHAR(2) NOT NULL,
|
||||
price DOUBLE PRECISION NOT NULL,
|
||||
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user