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:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user