group(function (): void { Route::post('/api/logout', [IdentityController::class, 'logout']); Route::post('/api/context', [IdentityController::class, 'select']); Route::middleware(RequireCompanyContext::class)->group(function (): void { Route::get('/api/catalogue-accounting', [\App\Modules\Services\Http\CatalogueAccountingController::class,'index']); Route::post('/api/catalogue-accounting/proposals', [\App\Modules\Services\Http\CatalogueAccountingController::class,'propose']); Route::post('/api/catalogue-accounting/proposals/{id}/submit', [\App\Modules\Services\Http\CatalogueAccountingController::class,'submit'])->whereNumber('id'); Route::post('/api/catalogue-accounting/proposals/{id}/decision', [\App\Modules\Services\Http\CatalogueAccountingController::class,'decide'])->whereNumber('id'); Route::get('/api/catalogue-accounting/services/{service}/resolve', [\App\Modules\Services\Http\CatalogueAccountingController::class,'resolve'])->whereNumber('service'); Route::post('/api/catalogue-accounting/resolutions', [\App\Modules\Services\Http\CatalogueAccountingController::class,'capture']); Route::get('/api/catalogue-accounting/history/{area}/{record}', [\App\Modules\Services\Http\CatalogueAccountingController::class,'history'])->whereNumber('record'); Route::post('/api/service-calculations/{id}', [\App\Modules\Services\Http\DocumentPreviewController::class, 'calculate'])->whereNumber('id'); Route::get('/api/document-preview/model', [\App\Modules\Services\Http\DocumentPreviewController::class, 'model']); Route::patch('/api/document-preview/model', [\App\Modules\Services\Http\DocumentPreviewController::class, 'configure']); Route::get('/api/document-preview/draft/{id}', [\App\Modules\Services\Http\DocumentPreviewController::class, 'draft'])->whereNumber('id'); Route::get('/api/document-preview/history/{id}', [\App\Modules\Services\Http\DocumentPreviewController::class, 'historical'])->whereNumber('id'); Route::get('/api/document-preview/{mode}/{id}/revision', [\App\Modules\Services\Http\DocumentPreviewController::class, 'revision'])->whereNumber('id'); Route::get('/api/document-preparation/{kind}', [\App\Modules\Services\Http\DocumentPreparationController::class, 'index']); Route::get('/api/document-preparation/{kind}/{id}', [\App\Modules\Services\Http\DocumentPreparationController::class, 'show'])->whereNumber('id'); Route::patch('/api/document-preparation/{kind}/{id}', [\App\Modules\Services\Http\DocumentPreparationController::class, 'save'])->whereNumber('id'); Route::post('/api/b1/billing-drafts/{id}/confirm-internal', [\App\Modules\Services\Http\ServiceController::class, 'confirmInternal'])->whereNumber('id'); Route::prefix('api/a/{area}')->group(function (): void { $controller = \App\Modules\Services\Http\ServiceController::class; Route::get('access', [$controller, 'accesses']); Route::post('access', [$controller, 'changeAccess']); Route::get('', [$controller, 'index']); Route::post('', [$controller, 'create']); Route::get('{id}', [$controller, 'show'])->whereNumber('id'); Route::patch('{id}', [$controller, 'update'])->whereNumber('id'); }); Route::get('/api/context', fn (\App\Shared\Context\CompanyContext $context) => response()->json($context->identifiers() + ['unit_id' => $context->unitId()])); Route::patch('/api/companies/{company}', [IdentityController::class, 'renameCompany']); Route::get('/api/companies/{company}', [IdentityController::class, 'company']); Route::get('/api/units/{unit}', [IdentityController::class, 'unit']); Route::patch('/api/units/{unit}', [IdentityController::class, 'renameUnit']); Route::post('/api/units', [IdentityController::class, 'createUnit']); Route::get('/api/accesses', [IdentityController::class, 'accesses']); Route::post('/api/accesses', [IdentityController::class, 'grant']); Route::post('/api/accesses/revoke', [IdentityController::class, 'revoke']); }); });