Schnellerkennung von Portalbuchungen per E-Mail

- IMAP-Abruf jede Minute (webklex/php-imap, ohne PHP-imap-Erweiterung) oder signierter Push von n8n
- Parser für Buchungs-, Storno- und Anfrage-Mails (de/en), Buchungsnummer, An-/Abreise
- Erkannte Buchungen werden sofort gesperrt und an handgepflegte Portale weitergegeben; Kalender-Abgleich übernimmt bzw. ersetzt Mail-Sperren
- Unklare Mails: Prüf-Mail + Admin-Liste Portal-E-Mails mit Aktion Sperre anlegen
- Überwachung des Postfachs in Monitor und /health/sync

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:29:26 +02:00
1 parent 0b7205e050
commit e5f9e0762f
33 files changed
+1450 -38

No files matched your search

+54
View File
@@ -0,0 +1,54 @@
<?php
namespace App\Models;
use App\Enums\PortalEmailStatus;
use App\Enums\PortalEmailType;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* A notification e-mail of a portal (e.g. "new booking" from FeWo-direkt) and what the system did with it.
* Only a short excerpt is stored, not the whole e-mail.
*/
#[Fillable(['channel_id', 'message_id', 'from', 'subject', 'received_at', 'type', 'status', 'starts_on', 'ends_on', 'reference', 'blocked_period_id', 'excerpt', 'note'])]
class PortalEmail extends Model
{
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'type' => PortalEmailType::class,
'status' => PortalEmailStatus::class,
'received_at' => 'immutable_datetime',
'starts_on' => 'immutable_date',
'ends_on' => 'immutable_date',
];
}
/**
* @return BelongsTo<Channel, $this>
*/
public function channel(): BelongsTo
{
return $this->belongsTo(Channel::class);
}
/**
* @return BelongsTo<BlockedPeriod, $this>
*/
public function blockedPeriod(): BelongsTo
{
return $this->belongsTo(BlockedPeriod::class);
}
public function period(): ?string
{
return $this->starts_on && $this->ends_on ? $this->starts_on->format('d.m.Y').' – '.$this->ends_on->format('d.m.Y') : null;
}
}