Eindeutige iCal-Kalenderspiegelungen automatisch und widerrufbar zuordnen
Deploy FeWo mit PipelineManager / deploy (push) Successful in 2m53s

This commit is contained in:
Lars committed 2026-10-29 17:01:30 +01:00
1 parent 8b36e07dc4
commit add2367869
16 files changed
+540 -31

No files matched your search

+3
View File
@@ -6,6 +6,7 @@
use App\Enums\OccupationKind;
use App\Models\BlockedPeriod;
use App\Models\Channel;
use App\Models\Property;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Validator;
@@ -30,6 +31,7 @@ public function handle(BlockedPeriod $occupation, OccupationKind $kind, ?int $or
throw ValidationException::withMessages(['origin_channel_id' => 'Privat und ein externer Buchungskanal können nicht gleichzeitig gewählt werden.']);
}
DB::transaction(function () use ($occupation, $kind, $originId, $details): void {
Property::query()->whereKey($occupation->property_id)->lockForUpdate()->firstOrFail();
$record = BlockedPeriod::query()->whereKey($occupation->id)->lockForUpdate()->firstOrFail();
if (! in_array($record->source, ['channel', 'email'], true) || $record->is_representation) {
throw ValidationException::withMessages(['occupation_kind' => 'Nur eigenständige Portalereignisse können hier eingeordnet werden.']);
@@ -44,6 +46,7 @@ public function handle(BlockedPeriod $occupation, OccupationKind $kind, ?int $or
'block_purpose' => $kind === OccupationKind::Block ? (array_key_exists('block_purpose', $details) ? $details['block_purpose'] : $record->block_purpose) : null,
'block_note' => $kind === OccupationKind::Block ? (array_key_exists('block_note', $details) ? $details['block_note'] : $record->block_note) : null,
])->save();
app(ReconcileChannelRepresentations::class)->handle($record->property);
});
}
}