Befund: v1 hatte keine KI-Deklarationsfelder — Submit lief seit der KI-Kennzeichnungspflicht (09.07.) immer auf 422 und haette alle Legacy-API-Kunden blockiert (Suite uebersah es: Factory deklariert). - v1-Submit verlangt ai_text_declaration; der Call gilt dokumentiert als verbindliche Bestaetigung (Art. 50 KI-VO) und schliesst die Archiv-Kenntnisnahme (AGB par. 13) ein - Bild-Upload verlangt ai_declaration (original/ai_generated/ai_edited) - Legacy-/service-Aliasse defaulten auf none/original — das API-Kunden-Mailing (R6.4) weist auf die Erklaerungswirkung hin - OpenAPI v1.yml + lang-Hinweis aktualisiert; Tests erweitert (Submit/Image/LegacyCompatibility) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
46 lines
1.5 KiB
PHP
46 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Api\V1;
|
|
|
|
use App\Enums\AiImageDeclaration;
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class StorePressReleaseImageRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user()?->tokenCan('press-release-images:write') === true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* KI-Kennzeichnung je Bild (Art. 50 KI-VO) ist im v1-Vertrag Pflicht;
|
|
* Legacy-/service-Clients kennen das Feld nicht — dort greift der
|
|
* Kompatibilitäts-Default „original" (Entscheidung 10.07.2026).
|
|
*
|
|
* @return array<string, ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
$isLegacyServiceCall = str_starts_with((string) $this->route()?->getName(), 'legacy-service.');
|
|
|
|
return [
|
|
'image' => ['required', 'image', 'mimes:jpg,jpeg,png,webp', 'max:8192'],
|
|
'ai_declaration' => [
|
|
Rule::requiredIf(! $isLegacyServiceCall),
|
|
'nullable',
|
|
Rule::enum(AiImageDeclaration::class),
|
|
],
|
|
'title' => ['nullable', 'string', 'max:120'],
|
|
'description' => ['nullable', 'string', 'max:500'],
|
|
'copyright' => ['nullable', 'string', 'max:255'],
|
|
'is_preview' => ['nullable', 'boolean'],
|
|
];
|
|
}
|
|
}
|