Visuelle iCal-Regelengine mit Originaldaten und individuellen Exportfeldern integrieren
Deploy FeWo mit PipelineManager / deploy (push) Successful in 2m37s

This commit is contained in:
Lars committed 2026-10-27 19:00:25 +01:00
1 parent c4ebccbbea
commit e9db98701b
30 files changed
+1269 -15

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
<?php
namespace App\Actions;
use App\Channels\ChannelSyncException;
use App\Channels\ICal\ICalAnalysis;
use App\Channels\ICal\ICalConnector;
use App\Models\Channel;
use Illuminate\Support\Facades\DB;
class AnalyzeChannelCalendar
{
public function handle(Channel $channel): Channel
{
if ($channel->connector !== 'ical' || blank($channel->setting('import_url')) || ! $channel->servesItsLandlord()) {
throw new ChannelSyncException('Für die Analyse eine iCal-Importadresse hinterlegen und den Kalenderdienst freischalten.');
}
$url = $channel->setting('import_url');
$analysis = app(ICalAnalysis::class)->summarize(app(ICalConnector::class)->fetchDocument($channel));
return DB::transaction(function () use ($channel, $url, $analysis): Channel {
$locked = Channel::query()->whereKey($channel->id)->lockForUpdate()->firstOrFail();
if ($locked->setting('import_url') !== $url) {
throw new ChannelSyncException('Die Importadresse wurde während der Analyse geändert. Bitte erneut analysieren.');
}
$locked->forceFill(['ical_analysis' => $analysis, 'ical_analyzed_at' => now()])->save();
return $locked;
});
}
}