Ergänze Aufbewahrung, Dokumentation und den Vertrag der Widget-Registry für das Widget Anfrage
CI Feature / test (push) Successful in 4m41s
CI Feature / test (push) Successful in 4m41s
Der Registry-Test erlaubt bewusst Widgets, die nur aus einem Verweis bestehen (Anfrage: nur die Kennung eines Einstiegs) und kennt die neue Widget-Art. ADR-60, Beschreibung der Kommunikationsverwaltung, Rückfall und Migration in der Release-Vorbereitung. Der Browser meldet laufende Zustandsabfragen über aria-busy. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c6a8167601
commit
22f8afdcd6
9 files changed
+257
-6
No files matched your search
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Domain\Communication\CommunicationSettings;
|
||||
use App\Domain\Communication\Inquiry;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
/**
|
||||
* Löscht Anfragen, die älter sind als die in „Kommunikation → Einstellungen“ gewählte Aufbewahrungsdauer. Ohne
|
||||
* Aufbewahrungsdauer geschieht nichts. Mit --pretend wird nur gezählt.
|
||||
*/
|
||||
class PurgeInquiries extends Command
|
||||
{
|
||||
protected $signature = 'communication:purge {--pretend : Nur zählen, nichts löschen}';
|
||||
|
||||
protected $description = 'Löscht Anfragen nach Ablauf der Aufbewahrungsdauer (Einstellungen der Kommunikationsverwaltung)';
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$months = CommunicationSettings::current()->retention_months;
|
||||
|
||||
if ($months === null || $months < 1) {
|
||||
$this->info('Keine Aufbewahrungsdauer eingestellt; es wird nichts gelöscht.');
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
$query = Inquiry::query()->where('created_at', '<', now()->subMonths($months));
|
||||
$count = $query->count();
|
||||
|
||||
if ($this->option('pretend')) {
|
||||
$this->info("$count Anfragen wären älter als $months Monate.");
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
$query->delete();
|
||||
$this->info("$count Anfragen gelöscht (älter als $months Monate).");
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user