Ein vergessener Postman-Platzhalter (PM_ID) lief als String in die int-typisierten Controller-Parameter. Numerische where-Constraints auf den v1- und /service-Gruppen; Legacy faellt in den 410-Catch-all. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
63 lines
3.7 KiB
PHP
63 lines
3.7 KiB
PHP
<?php
|
|
|
|
use App\Http\Controllers\Api\Legacy\LegacyCompanyController;
|
|
use App\Http\Controllers\Api\Legacy\LegacyContactController;
|
|
use App\Http\Controllers\Api\Legacy\LegacyPressReleaseController;
|
|
use App\Http\Controllers\Api\Legacy\LegacyPressReleaseImageController;
|
|
use App\Http\Controllers\Api\V1\CompanyController;
|
|
use App\Http\Controllers\Api\V1\PressReleaseController;
|
|
use App\Http\Controllers\Api\V1\PressReleaseImageController;
|
|
use App\Http\Middleware\EnsureApiTokenRateLimit;
|
|
use App\Http\Middleware\EnsureApiUserIsActive;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Legacy-API-Aliasse (Übernahme bestehender Integrationen, 06.07.2026)
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Die Altportale dokumentierten ihre API unter /service/... (JSON,
|
|
| X-ApiKey-Header). Diese Aliasse bilden die dokumentierte Alt-Oberfläche
|
|
| auf die v1-Controller ab, damit bestehende Kundenintegrationen nach dem
|
|
| Relaunch weiterlaufen (Auth: importierte Legacy-Keys, s. Middleware
|
|
| RejectLegacyApiKeys + legacy:import-api-keys). Läuft in der
|
|
| api-Middleware-Gruppe (bootstrap/app.php, then:) — ohne /api-Präfix.
|
|
|
|
|
| Nicht abgebildet (waren dokumentiert, existieren in v1 nicht):
|
|
| Pressemappen/Kontakte ANLEGEN sowie Einzelbild-GET — dafür antwortet
|
|
| der Fallback mit einem Hinweis auf Kundenkonto und neue Doku.
|
|
|
|
|
*/
|
|
|
|
Route::prefix('service')
|
|
->name('legacy-service.')
|
|
->middleware(['auth:sanctum', EnsureApiUserIsActive::class, EnsureApiTokenRateLimit::class])
|
|
// Nicht-numerische IDs fallen in den 410-Catch-all statt auf einen
|
|
// TypeError im Controller zu laufen.
|
|
->where(['pressRelease' => '[0-9]+', 'company' => '[0-9]+'])
|
|
->group(function (): void {
|
|
// Paritäts-Controller (10.07.2026, dev/release/api-legacy-paritaet.md):
|
|
// die 5 real genutzten Alt-Calls (connektar-Flow) verhaltensgleich —
|
|
// verschachtelte Alt-Params, Alt-Responses, Anlegen = Einreichen.
|
|
Route::post('pressreleases', [LegacyPressReleaseController::class, 'store'])->name('pressreleases.store');
|
|
Route::get('pressreleases/{pressRelease}', [LegacyPressReleaseController::class, 'show'])->name('pressreleases.show');
|
|
Route::post('pressreleases/{pressRelease}/images', [LegacyPressReleaseImageController::class, 'store'])->name('pressreleases.images.store');
|
|
Route::post('users/me/companies', [LegacyCompanyController::class, 'store'])->name('companies.store');
|
|
Route::post('users/me/companies/{company}/contacts', [LegacyContactController::class, 'store'])->name('contacts.store');
|
|
|
|
// Real ungenutzte, aber harmlose Lese-Aliasse (v1-Format).
|
|
Route::get('pressreleases', [PressReleaseController::class, 'index'])->name('pressreleases.index');
|
|
Route::get('pressreleases/{pressRelease}/images', [PressReleaseImageController::class, 'index'])->name('pressreleases.images.index');
|
|
Route::get('users/me/companies', [CompanyController::class, 'index'])->name('companies.index');
|
|
Route::get('users/me/companies/{company}', [CompanyController::class, 'show'])->name('companies.show');
|
|
});
|
|
|
|
// Alles Übrige unter /service/… (inkl. der nicht übernommenen
|
|
// Schreib-Endpoints für Pressemappen/Kontakte): klarer Hinweis statt 404.
|
|
Route::any('service/{path?}', function () {
|
|
return response()->json([
|
|
'message' => 'This legacy endpoint is not available anymore. Companies and press contacts are managed in your customer account; see the current API reference for everything else.',
|
|
'account_url' => url('/customer'),
|
|
'docs_url' => url('/docs/api/v1'),
|
|
], 410);
|
|
})->where('path', '.*')->name('legacy-service.gone');
|