docs: add comprehensive API reference documentation
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled

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:
Ovidiu U
2026-04-05 19:34:32 +01:00
parent 7101ed3550
commit 4f57c97015
4 changed files with 365 additions and 4 deletions

View File

@@ -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')

View File

@@ -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())

View File

@@ -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([