User Panel: Phase-8-Abschluss, Titelbild/Lizenzen/Zeitzonen und KI-Pruef-Pipeline

Phase 8 (Rest) + Umbauten vom 10./11.06.:
- Ein Titelbild pro PM (Cover 1280x580), SVG-Platzhalter-Set + Picker,
  PressReleaseCoverImage-Resolver
- Lizenz-/Rechteformular nach "Lizenztyp Bildupload" (7 Lizenztypen,
  Personen-/Sachrechte-Status, bedingte Pflichtfelder, Risikohinweise)
- Veroeffentlichungs-Box vereinfacht (Embargo aus der Form-UI entfernt),
  geplante Termine in Europe/Berlin (Speicherung UTC, DISPLAY_TIMEZONE)
- Quota-Stub (users.press_release_quota) + monatlicher Reset-Command
- Einreichungs-Modal einheitlich in Show/Create/Edit; Ghost-Buttons auf
  filled; PM-Editor-Layout responsive entkoppelt (.pr-editor-layout)

KI-Pruef-Pipeline (Phasen 1-5 des Entwicklungsplans):
- API-Haertung: status nicht mehr per API setzbar, eigene Submit-Route
  durch denselben Funnel (Blacklist, Quota, Status-Log)
- Klassifikation Rot/Gelb/Gruen asynchron (Queue classification,
  OpenAI-Treiber + deterministischer Fallback), ki_audits-Audit-Log
- Routing: Rot -> rejected + Mail, Gelb -> Review-Queue, Gruen ->
  Auto-Publish; Scheduler publiziert nur gruene faellige PMs
- Content-Score 0-100 -> Stufe (Standard/Geprueft/Hochwertig) inkl.
  Editor-Panel und Badges; Re-Klassifikation/-Score bei Aenderung
- Admin: KI-Badge + Filter, On-Demand-Pruefung mit Anbieter-Override

Suite: 442 passed, 4 skipped.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-06-12 08:30:13 +00:00
parent 0efabaf446
commit a000238ca8
141 changed files with 5922 additions and 1001 deletions

View file

@ -0,0 +1,53 @@
<?php
namespace Database\Factories;
use App\Enums\PressReleaseClassification;
use App\Models\KiAudit;
use App\Models\PressRelease;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<KiAudit>
*/
class KiAuditFactory extends Factory
{
protected $model = KiAudit::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$classification = fake()->randomElement(PressReleaseClassification::cases());
return [
'press_release_id' => PressRelease::factory(),
'type' => KiAudit::TYPE_CLASSIFICATION,
'provider' => 'anthropic',
'model' => 'claude-sonnet-4-6',
'result' => $classification->value,
'reason' => fake()->optional()->sentence(),
'raw_response' => ['classification' => $classification->value, 'reasons' => []],
'created_at' => now(),
];
}
public function classification(PressReleaseClassification $classification): static
{
return $this->state(fn (): array => [
'type' => KiAudit::TYPE_CLASSIFICATION,
'result' => $classification->value,
]);
}
public function contentScore(int $score): static
{
return $this->state(fn (): array => [
'type' => KiAudit::TYPE_CONTENT_SCORE,
'result' => (string) $score,
]);
}
}

View file

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('press_releases', function (Blueprint $table) {
$table->string('placeholder_variant', 32)->nullable()->after('boilerplate_override');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('press_releases', function (Blueprint $table) {
$table->dropColumn('placeholder_variant');
});
}
};

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('press_release_images', function (Blueprint $table) {
$table->string('author')->nullable()->after('copyright');
$table->string('license_type', 32)->nullable()->after('author');
$table->string('license_url')->nullable()->after('license_type');
$table->boolean('persons_consent')->default(false)->after('license_url');
$table->timestamp('rights_confirmed_at')->nullable()->after('persons_consent');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('press_release_images', function (Blueprint $table) {
$table->dropColumn(['author', 'license_type', 'license_url', 'persons_consent', 'rights_confirmed_at']);
});
}
};

View file

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->unsignedInteger('press_release_quota')->default(3);
$table->unsignedInteger('press_release_quota_used_this_month')->default(0);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['press_release_quota', 'press_release_quota_used_this_month']);
});
}
};

View file

@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('press_release_images', function (Blueprint $table) {
$table->string('license_detail', 120)->nullable()->after('license_type');
$table->string('source_url', 2048)->nullable()->after('license_url');
$table->string('people_rights_status', 40)->nullable()->after('persons_consent');
$table->string('property_rights_status', 40)->nullable()->after('people_rights_status');
$table->text('rights_notes')->nullable()->after('property_rights_status');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('press_release_images', function (Blueprint $table) {
$table->dropColumn([
'license_detail',
'source_url',
'people_rights_status',
'property_rights_status',
'rights_notes',
]);
});
}
};

View file

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('press_releases', function (Blueprint $table): void {
// KI-Klassifikation („Red Flag", Konzept §15.1). Nullable: erst ab
// Phase 3 befüllt, ändert in Phase 2 noch kein Verhalten.
$table->string('classification', 16)->nullable()->after('status');
$table->timestamp('classified_at')->nullable()->after('classification');
$table->index('classification', 'press_releases_classification_idx');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('press_releases', function (Blueprint $table): void {
$table->dropIndex('press_releases_classification_idx');
$table->dropColumn(['classification', 'classified_at']);
});
}
};

View file

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('ki_audits', function (Blueprint $table): void {
$table->id();
$table->foreignId('press_release_id')
->constrained()
->cascadeOnDelete();
// classification | content_score — welche KI-Bewertung dies protokolliert.
$table->string('type', 32);
$table->string('provider', 32)->nullable();
$table->string('model', 64)->nullable();
// Ergebnis als String (z. B. green/yellow/red) oder Score-Wert.
$table->string('result', 64)->nullable();
$table->text('reason')->nullable();
// Vollständige Roh-Antwort der KI für Nachvollziehbarkeit (DSGVO).
$table->json('raw_response')->nullable();
$table->timestamp('created_at')->useCurrent();
$table->index(['press_release_id', 'type'], 'ki_audits_pr_type_idx');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ki_audits');
}
};

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('press_releases', function (Blueprint $table): void {
// Content-Score (0100, Konzept §15.2) und abgeleitete Stufe
// (standard|gepruft|hochwertig, Update 2). Nullable: erst ab Phase 5
// befüllt.
$table->unsignedTinyInteger('content_score')->nullable()->after('classified_at');
$table->string('content_tier', 16)->nullable()->after('content_score');
$table->timestamp('scored_at')->nullable()->after('content_tier');
$table->index('content_tier', 'press_releases_content_tier_idx');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('press_releases', function (Blueprint $table): void {
$table->dropIndex('press_releases_content_tier_idx');
$table->dropColumn(['content_score', 'content_tier', 'scored_at']);
});
}
};