ldc-arcadia-api/routes/apiv1.php

64 lines
2.5 KiB
PHP

<?php
declare(strict_types=1);
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Route;
use Presentation\Api\V1\Http\Controllers\Brands\BrandShowController;
use Presentation\Api\V1\Http\Controllers\Brands\BrandsIndexController;
use Presentation\Api\V1\Http\Controllers\Employees\EmployeeShowController;
use Presentation\Api\V1\Http\Controllers\Employees\EmployeesIndexController;
use Presentation\Api\V1\Http\Controllers\Health\HealthCheckController;
use Presentation\Api\V1\Http\Controllers\IncoCompositions\IncoCompositionShowController;
use Presentation\Api\V1\Http\Controllers\IncoSheets\IncoSheetsIndexController;
use Presentation\Api\V1\Http\Controllers\IncoSheets\IncoSheetsSearchController;
use Presentation\Api\V1\Http\Controllers\IncoSheets\IncoSheetsShowController;
/*
|--------------------------------------------------------------------------
| API V1 Routes
|--------------------------------------------------------------------------
|
| Version 1 of the Arcadia API.
| All routes are prefixed with /api/v1 (configured in bootstrap/app.php).
|
*/
// * ROOT
Route::get('/', fn () => response()->json([
'message' => Config::string('app.name') . ' v1',
'spec' => route('api.v1.openapi'),
]))->name('root');
// * HEALTH CHECK
Route::get('/health', HealthCheckController::class)->name('health');
// * OPENAPI
Route::get('/openapi', function () {
return response()->file(
base_path('documentation/OpenApi/openapi.yaml'),
['Content-Type' => 'application/yaml']
);
})->name('openapi');
Route::middleware('auth.hmac')->group(function (): void {
// * EMPLOYEES
Route::prefix('employees')->group(function (): void {
Route::get('/', EmployeesIndexController::class)->name('employees.index');
Route::get('/{employeeId}', EmployeeShowController::class)->name('employees.show');
});
// * BRANDS
Route::prefix('brands')->group(function (): void {
Route::get('/', BrandsIndexController::class)->name('brands.index');
Route::get('/{identifier}', BrandShowController::class)->name('brands.show');
});
// * INCO SHEETS
Route::prefix('inco-sheets')->group(function (): void {
Route::get('/', IncoSheetsIndexController::class)->name('inco-sheets.index');
Route::get('/search', IncoSheetsSearchController::class)->name('inco-sheets.search');
Route::get('/{incoId}', IncoSheetsShowController::class)->name('inco-sheets.show');
Route::get('/{incoId}/composition', IncoCompositionShowController::class)->name('inco-sheets.composition');
});
});