Portal-Synchronisation: unser System führt

- Connector-System (app/Channels, config/channels.php) mit iCal-Connector, robustem Parser und Export-Feed je Portal (ohne eigene Belegungen, ohne Gästedaten)
- Abgleich alle 5 Min. mit Protokoll, Echo-Erkennung, Konflikt-Mail bei möglicher Doppelbuchung
- Überwachung: Störungs-Mail, Status-Endpunkt /health/sync für n8n
- Portal-Aufgaben für Sofortbuchungsportale (FeWo-direkt): automatisch aus Buchungen/Sperren/anderen Portalen, Mail + Erinnerung, Abhaken im Admin
- Optionaler signierter Automatisierungs-Webhook mit Rückmeldung
- Herkunftsmessung: Abfrage im Formular + UTM-Parameter
- Portal-Analyse: AGB-Prüfung Automatisierung, Umsetzungsbeschreibung

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lars StommerandClaude Opus 5.5 committed 2026-10-22 11:13:55 +02:00
1 parent a8e72715ab
commit 0b7205e050
55 files changed
+2290 -3

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
<?php
namespace Database\Factories;
use App\Models\Channel;
use App\Models\Property;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Channel>
*/
class ChannelFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'property_id' => Property::factory(),
'name' => fake()->randomElement(['FeWo-direkt', 'Ostseeklar', 'ferienundwohnen.de']),
'connector' => 'ical',
'settings' => ['import_url' => 'https://portal.example/ical/'.fake()->uuid().'.ics'],
'is_active' => true,
'requires_manual_blocking' => false,
];
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace Database\Factories;
use App\Enums\ChannelTaskAction;
use App\Enums\ChannelTaskStatus;
use App\Models\Channel;
use App\Models\ChannelTask;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<ChannelTask>
*/
class ChannelTaskFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'channel_id' => Channel::factory(),
'action' => ChannelTaskAction::Block,
'starts_on' => now()->addDays(30)->toDateString(),
'ends_on' => now()->addDays(37)->toDateString(),
'reason' => 'Buchung',
'status' => ChannelTaskStatus::Open,
];
}
}
@@ -0,0 +1,39 @@
<?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('channels', function (Blueprint $table) {
$table->id();
$table->foreignId('property_id')->constrained()->cascadeOnDelete();
$table->string('name');
$table->string('connector');
$table->json('settings')->nullable();
$table->string('export_token', 64)->unique();
$table->boolean('is_active')->default(true);
$table->boolean('requires_manual_blocking')->default(false);
$table->string('manage_url')->nullable();
$table->dateTime('last_synced_at')->nullable();
$table->dateTime('last_success_at')->nullable();
$table->text('last_error')->nullable();
$table->dateTime('alerted_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('channels');
}
};
@@ -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::create('channel_sync_logs', function (Blueprint $table) {
$table->id();
$table->foreignId('channel_id')->constrained()->cascadeOnDelete();
$table->boolean('successful');
$table->unsignedSmallInteger('events')->default(0);
$table->unsignedSmallInteger('added')->default(0);
$table->unsignedSmallInteger('changed')->default(0);
$table->unsignedSmallInteger('removed')->default(0);
$table->unsignedSmallInteger('conflicts')->default(0);
$table->text('message')->nullable();
$table->unsignedInteger('duration_ms')->default(0);
$table->timestamp('created_at')->useCurrent();
$table->index(['channel_id', 'created_at']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('channel_sync_logs');
}
};
@@ -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::create('channel_tasks', function (Blueprint $table) {
$table->id();
$table->foreignId('channel_id')->constrained()->cascadeOnDelete();
$table->string('action');
$table->date('starts_on');
$table->date('ends_on');
$table->string('reason');
$table->string('status')->default('open')->index();
$table->string('completed_by')->nullable();
$table->dateTime('completed_at')->nullable();
$table->dateTime('reminded_at')->nullable();
$table->dateTime('automation_sent_at')->nullable();
$table->text('automation_error')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('channel_tasks');
}
};
@@ -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::table('blocked_periods', function (Blueprint $table) {
$table->foreignId('channel_id')->nullable()->after('property_id')->constrained()->cascadeOnDelete();
$table->index(['channel_id', 'external_uid']);
});
Schema::table('bookings', function (Blueprint $table) {
$table->string('referral_source')->nullable()->after('source');
$table->string('utm_source')->nullable()->after('referral_source');
$table->string('utm_medium')->nullable()->after('utm_source');
$table->string('utm_campaign')->nullable()->after('utm_medium');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('bookings', function (Blueprint $table) {
$table->dropColumn(['referral_source', 'utm_source', 'utm_medium', 'utm_campaign']);
});
Schema::table('blocked_periods', function (Blueprint $table) {
$table->dropIndex(['channel_id', 'external_uid']);
$table->dropConstrainedForeignId('channel_id');
});
}
};