docs: add comprehensive API reference documentation
Adds complete API reference (api-reference.md) covering all endpoints: /api/stations (nearby search with postcode/lat+lng), /api/stats/searches (aggregated search stats), /api/prediction (7-day price forecast with multi-signal breakdown), and auth routes (register/login/logout/me). Includes request/response examples, error shapes, fuel type aliases, and signal structure details. Also removes unused AccountWidget from admin panel, disables BrentPriceChartWidget discovery, and adds searches stat to StatsOverviewWidget. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,8 @@ class BrentPriceChartWidget extends ChartWidget
|
||||
|
||||
protected ?string $pollingInterval = null;
|
||||
|
||||
protected static bool $isDiscovered = false;
|
||||
|
||||
protected function getData(): array
|
||||
{
|
||||
$prices = BrentPrice::orderBy('date')
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Filament\Widgets;
|
||||
|
||||
use App\Models\ApiLog;
|
||||
use App\Models\PricePrediction;
|
||||
use App\Models\Search;
|
||||
use App\Models\Station;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
@@ -18,6 +19,7 @@ class StatsOverviewWidget extends BaseWidget
|
||||
{
|
||||
return [
|
||||
$this->usersStat(),
|
||||
$this->searchesStat(),
|
||||
$this->stationsStat(),
|
||||
$this->oilPredictionStat(),
|
||||
$this->apiErrorsStat(),
|
||||
@@ -31,6 +33,13 @@ class StatsOverviewWidget extends BaseWidget
|
||||
->color('primary');
|
||||
}
|
||||
|
||||
private function searchesStat(): Stat
|
||||
{
|
||||
return Stat::make('Total searches', Search::count())
|
||||
->icon('heroicon-o-magnifying-glass')
|
||||
->color('primary');
|
||||
}
|
||||
|
||||
private function stationsStat(): Stat
|
||||
{
|
||||
$count = Station::count();
|
||||
@@ -58,8 +67,7 @@ class StatsOverviewWidget extends BaseWidget
|
||||
$ageHours = $prediction->generated_at->diffInHours(now());
|
||||
$color = $ageHours > 24 ? 'warning' : 'success';
|
||||
$value = ucfirst($prediction->direction->value)
|
||||
.' · '.$prediction->confidence.'%'
|
||||
.' · '.strtoupper($prediction->source->value);
|
||||
.' · '.$prediction->confidence.'%';
|
||||
|
||||
return Stat::make('Latest oil prediction', $value)
|
||||
->description('Generated '.$prediction->generated_at->diffForHumans())
|
||||
|
||||
@@ -11,7 +11,6 @@ use Filament\Pages\Dashboard;
|
||||
use Filament\Panel;
|
||||
use Filament\PanelProvider;
|
||||
use Filament\Support\Colors\Color;
|
||||
use Filament\Widgets\AccountWidget;
|
||||
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies;
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestForgery;
|
||||
@@ -39,7 +38,6 @@ class AdminPanelProvider extends PanelProvider
|
||||
])
|
||||
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\Filament\Widgets')
|
||||
->widgets([
|
||||
AccountWidget::class,
|
||||
StatsOverviewWidget::class,
|
||||
])
|
||||
->middleware([
|
||||
|
||||
Reference in New Issue
Block a user