Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92ccf40312 | ||
|
|
6d8f1d6692 | ||
|
|
abf0e9004b | ||
|
|
3a0bb6e40f |
No files matched your search
@@ -36,11 +36,37 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: shivammathur/setup-php@v2
|
||||
- name: Runner-Umgebung prüfen
|
||||
shell: bash
|
||||
run: |
|
||||
uname -m
|
||||
cat /etc/os-release
|
||||
id
|
||||
if command -v php >/dev/null 2>&1; then
|
||||
php --version
|
||||
else
|
||||
echo 'PHP ist noch nicht im PATH.'
|
||||
fi
|
||||
if command -v apt-cache >/dev/null 2>&1; then
|
||||
apt-cache policy php8.4 php8.4-cli php8.4-dev
|
||||
fi
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
echo 'Runner läuft als root.'
|
||||
elif command -v sudo >/dev/null 2>&1 && sudo -n true; then
|
||||
echo 'Passwortloses sudo ist verfügbar.'
|
||||
else
|
||||
echo '::error::setup-php benötigt auf diesem Host passwortloses sudo; der Runner hat es nicht.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# act_runner v0.2.11 supports Node 20; newer setup-php releases require Node 24.
|
||||
- uses: shivammathur/setup-php@2.36.0
|
||||
with:
|
||||
php-version: '8.4'
|
||||
extensions: mbstring, intl, gd, exif, zip, pdo_sqlite, sqlite3, pdo_mysql, fileinfo, openssl
|
||||
tools: composer:v2
|
||||
env:
|
||||
runner: self-hosted
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
@@ -56,7 +82,7 @@ jobs:
|
||||
php artisan key:generate
|
||||
|
||||
- name: Tests (SQLite)
|
||||
run: php artisan test --compact
|
||||
run: php artisan test --compact --testsuite=Feature
|
||||
|
||||
- name: Tests (MariaDB 11.8, wie auf Strato)
|
||||
env:
|
||||
@@ -66,7 +92,7 @@ jobs:
|
||||
DB_DATABASE: fewo_test
|
||||
DB_USERNAME: root
|
||||
DB_PASSWORD: test
|
||||
run: php artisan test --compact
|
||||
run: php artisan test --compact --testsuite=Feature
|
||||
|
||||
deploy:
|
||||
needs: test
|
||||
@@ -75,11 +101,14 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: shivammathur/setup-php@v2
|
||||
# Keep the runtime compatible with the test job and the installed act_runner.
|
||||
- uses: shivammathur/setup-php@2.36.0
|
||||
with:
|
||||
php-version: '8.4'
|
||||
extensions: mbstring, intl, gd, exif, zip, fileinfo, openssl
|
||||
tools: composer:v2
|
||||
env:
|
||||
runner: self-hosted
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
|
||||
@@ -28,7 +28,7 @@ public static function configure(Schema $schema): Schema
|
||||
->schema([
|
||||
Builder::make('sections')
|
||||
->hiddenLabel()
|
||||
->blocks(fn (): array => app(SectionRegistry::class)->blocks())
|
||||
->blocks(fn (callable $get): array => app(SectionRegistry::class)->blocks($get('site_id')))
|
||||
->addActionLabel('Baustein hinzufügen')
|
||||
->collapsible()
|
||||
->collapsed()
|
||||
|
||||
@@ -3,18 +3,19 @@
|
||||
namespace App\Themes;
|
||||
|
||||
use App\Models\Appearance;
|
||||
use App\Models\Property;
|
||||
use App\Themes\Sections\Section;
|
||||
use Filament\Forms\Components\Builder\Block;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\View as ViewFactory;
|
||||
|
||||
/**
|
||||
* The section catalogue from config/themes.php: builder blocks for the admin and rendering for the website.
|
||||
*
|
||||
* Every placed section carries data.id (a stable UUID, see Page::assignSectionIds) so appearances can
|
||||
* address it, and data.appearances (appearance ids; empty = always shown).
|
||||
* address it, data.appearances (appearance ids; empty = always shown), and an optional data.property_id
|
||||
* (an active property of this website; empty = primary property).
|
||||
*/
|
||||
class SectionRegistry
|
||||
{
|
||||
@@ -38,7 +39,7 @@ public function get(string $key): ?Section
|
||||
/**
|
||||
* @return list<Block>
|
||||
*/
|
||||
public function blocks(): array
|
||||
public function blocks(?int $siteId = null): array
|
||||
{
|
||||
return array_values(array_map(
|
||||
fn (string $class): Block => Block::make($class::key())
|
||||
@@ -47,6 +48,17 @@ public function blocks(): array
|
||||
->schema([
|
||||
Hidden::make('id'),
|
||||
...$class::schema(),
|
||||
Select::make('property_id')
|
||||
->label('Wohnung')
|
||||
->placeholder('Hauptwohnung')
|
||||
->helperText('Leer = Hauptwohnung dieser Website.')
|
||||
->options(fn (): array => Property::query()
|
||||
->where('site_id', $siteId)
|
||||
->whereNotNull('site_id')
|
||||
->where('is_active', true)
|
||||
->orderBy('name')
|
||||
->pluck('name', 'id')
|
||||
->all()),
|
||||
Select::make('appearances')
|
||||
->label('Nur anzeigen im Erscheinungsbild')
|
||||
->helperText('Leer = immer anzeigen. Z. B. ein Weihnachts-Baustein nur im Erscheinungsbild „Weihnachten“.')
|
||||
@@ -70,11 +82,11 @@ public function isVisible(Theme $theme, array $data): bool
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the stored sections of a page; unknown or failing types are skipped (and reported),
|
||||
* so a page never breaks because of one section.
|
||||
* Prepares the stored sections for deferred rendering. Unknown types, missing views, hidden sections
|
||||
* and unavailable property assignments are skipped.
|
||||
*
|
||||
* @param list<array{type: string, data?: array<string, mixed>}>|null $sections
|
||||
* @return list<View>
|
||||
* @return list<SectionView>
|
||||
*/
|
||||
public function render(Theme $theme, ?array $sections): array
|
||||
{
|
||||
@@ -85,11 +97,24 @@ public function render(Theme $theme, ?array $sections): array
|
||||
continue;
|
||||
}
|
||||
|
||||
$views[] = ViewFactory::make($section->view(), [
|
||||
...$section->data($theme, $stored['data'] ?? []),
|
||||
'theme' => $theme,
|
||||
'sectionId' => $section::key().'-'.$index,
|
||||
]);
|
||||
$data = $stored['data'] ?? [];
|
||||
$property = filled($data['property_id'] ?? null)
|
||||
? $theme->site->properties()->where('is_active', true)->whereKey($data['property_id'])->first()
|
||||
: $theme->property();
|
||||
|
||||
if (filled($data['property_id'] ?? null) && $property === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$views[] = $theme->runForProperty($property, fn (): SectionView => new SectionView(
|
||||
$theme,
|
||||
$property,
|
||||
ViewFactory::make($section->view(), [
|
||||
...$section->data($theme, $data),
|
||||
'theme' => $theme,
|
||||
'sectionId' => $section::key().'-'.$index,
|
||||
]),
|
||||
));
|
||||
}
|
||||
|
||||
return $views;
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Themes;
|
||||
|
||||
use App\Models\Property;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
||||
/**
|
||||
* Keeps the section's property active when the page eventually renders its Blade view and partials.
|
||||
*/
|
||||
class SectionView implements Renderable
|
||||
{
|
||||
public function __construct(
|
||||
private Theme $theme,
|
||||
private ?Property $property,
|
||||
private View $view,
|
||||
) {}
|
||||
|
||||
public function render(): string
|
||||
{
|
||||
return $this->theme->runForProperty($this->property, fn (): string => $this->view->render());
|
||||
}
|
||||
}
|
||||
@@ -174,6 +174,29 @@ public function property(): ?Property
|
||||
return $this->property;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a section with its property, restoring the previous cache even when rendering fails.
|
||||
*
|
||||
* @template T
|
||||
*
|
||||
* @param callable(): T $callback
|
||||
* @return T
|
||||
*/
|
||||
public function runForProperty(?Property $property, callable $callback): mixed
|
||||
{
|
||||
$previousProperty = $this->property;
|
||||
$previousResolved = $this->propertyResolved;
|
||||
$this->property = $property;
|
||||
$this->propertyResolved = true;
|
||||
|
||||
try {
|
||||
return $callback();
|
||||
} finally {
|
||||
$this->property = $previousProperty;
|
||||
$this->propertyResolved = $previousResolved;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Published pages of a menu location ("main" or "footer").
|
||||
*
|
||||
|
||||
@@ -78,6 +78,8 @@ ## 4. Tägliche Nutzung
|
||||
## 5. Automatisch über Gitea Actions
|
||||
|
||||
- Workflow `.gitea/workflows/deploy.yml`: **Tests bei jedem Push**; **Deployment** bei Tags `v*` (z. B. `git tag v1.0.0 && git push --tags`) oder per Knopfdruck (Actions › Deploy › Run workflow, Ziel production/staging).
|
||||
- Runner-Kompatibilität (26.10.2026): Der vorhandene `act_runner v0.2.11` unterstützt Actions bis Node 20. `setup-php` ist deshalb in beiden Jobs auf `2.36.0` (Node 20) festgelegt; das bewegliche `@v2` benötigt inzwischen Node 24 und bricht vor den Tests ab. Erst nach einem Runner-Upgrade wieder anheben. Beide Datenbank-Testläufe wählen ausdrücklich `--testsuite=Feature`, weil `tests/Unit` nicht existiert.
|
||||
- Zweiter Lauf (26.10.): Checkout erfolgreich, danach `Could not setup PHP 8.4`. Das Log nennt `hostexecutor`: Das Label `ubuntu-latest` beweist bei Gitea kein Ubuntu-Container-System. Der Workflow gibt vor der Installation deshalb Architektur, `/etc/os-release`, Benutzer, vorhandenes PHP, APT-Kandidaten für PHP 8.4 und die Verfügbarkeit von passwortlosem sudo aus. Beide PHP-Setup-Schritte setzen ausdrücklich `runner: self-hosted`. Die genaue Installationsursache ist mit dem bisherigen Log noch offen; keine Paketquellen, sudo-Regeln oder Runner-Labels ohne Prüfung ändern.
|
||||
- Voraussetzung: Gitea Actions aktiviert und ein **act_runner** registriert – passt gut auf den privaten Server (Docker). Anleitung: Gitea-Doku „Act Runner“.
|
||||
- Repository-Secrets: `DEPLOY_SSH_KEY` (privater Schlüssel, dessen öffentlicher Teil bei Strato hinterlegt ist), `DEPLOY_HOST`, `DEPLOY_USER`, `DEPLOY_PATH`, `DEPLOY_PHP`, `DEPLOY_URL`.
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ ## 9. Betrieb und Abgrenzung
|
||||
|
||||
## 10. Freigabe
|
||||
|
||||
**Phasen 1 bis 5 sind umgesetzt und ausgeliefert**, von Phase 6 die Anwendungsseite (auf `main`, noch nicht ausgeliefert). Der Grundumbau ist damit fertig: Daten, Rollen, Einstellungen, Domains, Hintergrundläufe, Export und Kündigung, dazu Bildwelten und die Marke je Website. **Phase 7 schließt eine eigene Sitzung ab**; die Übergabe dafür steht in [STATUS.md](STATUS.md) Abschnitt 7. Die bisherigen Daten gehören zum Mandanten Stommer, `lars@stommer.com` ist Betreiber. Ausgelieferter Stand und Übergabe: [STATUS.md](STATUS.md) Abschnitt 7.
|
||||
**Phasen 1 bis 5 und die Anwendungsseite von Phase 6 sind umgesetzt und ausgeliefert** (Release `20261026065920`). Der Grundumbau ist damit fertig: Daten, Rollen, Einstellungen, Domains, Hintergrundläufe, Export und Kündigung, dazu Bildwelten und die Marke je Website. **Phase 7 schließt eine eigene Sitzung ab**; die Übergabe dafür steht in [STATUS.md](STATUS.md) Abschnitt 7. Die bisherigen Daten gehören zum Mandanten Stommer, `lars@stommer.com` ist Betreiber. Ausgelieferter Stand und Übergabe: [STATUS.md](STATUS.md) Abschnitt 7.
|
||||
|
||||
Offen und **nicht** Teil dieses Plans: Subscription und Abrechnung (§9 schließt sie aus; `service_usages` liegt als Grundlage bereit) sowie die Frage, ob Strato für die Domain eines Mandanten ein Zertifikat ausstellt – davon hängt ab, ob das Modell „Mandant bringt seine Domain mit" auf diesem Hosting trägt. Phase 6 und 7 warten auf eine eigene Freigabe und einen Eintrag in [ZUSAMMENARBEIT.md](ZUSAMMENARBEIT.md) §6.
|
||||
|
||||
|
||||
+19
-14
@@ -1,6 +1,6 @@
|
||||
# Projektstand
|
||||
|
||||
Stand: 24.10.2026 · ausgelieferter Stand: `deploy/staging/20261024152057` · `main` ist voraus (Phase 6 noch nicht ausgeliefert) · 272 Feature-Tests grün
|
||||
Stand: 26.10.2026 · ausgelieferter Stand: `deploy/staging/20261026072521` (`abf0e90`) · 285 Feature-Tests grün
|
||||
|
||||
> Dieses Dokument ist der Einstieg für jede neue Arbeitssitzung. Bitte bei größeren Änderungen fortschreiben (Abschnitte „Fertig“, „Offen“, „Nächste Schritte“).
|
||||
|
||||
@@ -70,7 +70,7 @@ ## 3. Offen
|
||||
**Technik**
|
||||
- Cronjob auf Strato einrichten (BETRIEB.md §6).
|
||||
- Design-Theme Seebad 0.3 ist auf `main` und auf stommer.info aktiv (Abschnitt 6).
|
||||
- Mandantenfähigkeit: **Phasen 1 bis 5 sind umgesetzt** – der Grundumbau ist fertig. Stand, Bausteine und Fallen stehen in Abschnitt 7. Plan: `docs/MANDANTEN-PLAN.md`.
|
||||
- Mandantenfähigkeit: **Phasen 1 bis 5, die Anwendungsseite von Phase 6 und der Kern von Phase 7 sind ausgeliefert**. Bausteine können eine aktive Wohnung ihrer Website wählen; leer = Hauptwohnung. Stand, Bausteine und Fallen stehen in Abschnitt 7. Plan: `docs/MANDANTEN-PLAN.md`.
|
||||
- Logo in E-Mails und im Vertrags-PDF (`public/brand/logo-600.png` liegt bereit).
|
||||
- Content-Security-Policy: braucht wegen Livewire/Filament Nonces und einen sorgfältigen Test.
|
||||
- Produktion `www.fewo-stommer.de` vorbereiten:
|
||||
@@ -135,25 +135,29 @@ ## 6. Design-Theme „Seebad“ (Abschnitt der Design-Session)
|
||||
|
||||
## 7. Mandanten – Übergabe an die nächste Sitzung
|
||||
|
||||
Stand: 24.10.2026, abends · Branch `main` (`c459f7f`) · Plan: [MANDANTEN-PLAN.md](MANDANTEN-PLAN.md) · Anforderungen: [MANDANTEN-ANFORDERUNGEN.md](MANDANTEN-ANFORDERUNGEN.md)
|
||||
Stand: 26.10.2026 · Phase-7-Kern auf `main` und Strato · Plan: [MANDANTEN-PLAN.md](MANDANTEN-PLAN.md) · Anforderungen: [MANDANTEN-ANFORDERUNGEN.md](MANDANTEN-ANFORDERUNGEN.md)
|
||||
|
||||
> **`main` ist dem Server voraus.** Ausgeliefert ist `20261024152057` (Commit `2c5b5fc`, Phasen 1–5). Phase 6 (Bildwelten, Marke) liegt seit `4e66add` auf `main` und ist **nicht** ausgeliefert; sie bringt eine Migration mit (`image_world` an `sites` und `properties`). Vor dem nächsten Deploy also sichern wie immer: `bash scripts/backup-pull.sh staging /c/Dev/fewo-backups/staging`, dann `bash scripts/deploy.sh staging deploy`.
|
||||
> **Ausgeliefert:** `20261026072521`, Commit `abf0e90`, aus aktuellem `main` nach `test.fewo-stommer.de/` (https://stommer.info). Sicherung davor: `C:\Dev\fewo-backups\staging\20261026-082223` (Datenbank und Dateien, 29 MB). Aktiven Pfad und `REVISION` per SSH geprüft; `/up`, `/`, `/wohnung`, `/buchen` und `/admin/login` liefern HTTP 200. Vor jedem weiteren Deploy sichern: `bash scripts/backup-pull.sh staging /c/Dev/fewo-backups/staging`, dann `bash scripts/deploy.sh staging deploy` (nur aus aktuellem `main`).
|
||||
|
||||
**Der Grundumbau (Phasen 1–5) ist fertig.** Von Phase 6 ist die **Anwendungsseite gebaut** (Bildwelten, Marke je Website) – ohne eine einzige Theme-Datei zu ändern; der Rest ist ein Vertragsfall und steht als Aufgabe für die Theme-Sitzung in ZUSAMMENARBEIT.md §6: Favicon und die fest verdrahteten Grafiken in `ostsee-licht` auf `$theme->brand()` bzw. Plätze umstellen. Offen bleibt Phase 7 (mehrere Wohnungen je Website). Nicht im Plan und offen: Subscription/Abrechnung und die Zertifikatsfrage bei Strato.
|
||||
**Der Grundumbau (Phasen 1–5) ist fertig.** Von Phase 6 ist die **Anwendungsseite gebaut** (Bildwelten, Marke je Website) – ohne eine einzige Theme-Datei zu ändern; der Rest ist ein Vertragsfall und steht als Aufgabe für die Theme-Sitzung in ZUSAMMENARBEIT.md §6: Favicon und die fest verdrahteten Grafiken in `ostsee-licht` auf `$theme->brand()` bzw. Plätze umstellen. Der Kern von Phase 7 ist ebenfalls umgesetzt und ausgeliefert. Nicht im Plan und offen: Subscription/Abrechnung und die Zertifikatsfrage bei Strato.
|
||||
|
||||
### Hier weitermachen: Phase 7
|
||||
### Phase 7: Kern umgesetzt und ausgeliefert
|
||||
|
||||
Ziel (A21): Ein Baustein kann eine Wohnung **dieser Website** wählen; ohne Wahl gilt wie heute die Hauptwohnung. Voraussetzung für die Bergwohnung unter `fewo-stommer.de`.
|
||||
|
||||
**Der Kern braucht keine Theme-Änderung.** Bestehende Vorlagen rufen `$theme->property()`; wenn der Renderer vor dem Baustein die gewählte Wohnung setzt, bleiben sie unverändert gültig. Ein Eintrag in [ZUSAMMENARBEIT.md](ZUSAMMENARBEIT.md) §6 wird erst fällig, wenn **neue** Bausteine dazukommen (Übersicht aller Wohnungen, Suche über mehrere) – die brauchen eine Pflicht-Vorlage im Basis-Theme.
|
||||
**Ohne Theme-Änderung umgesetzt.** Alle Bausteine haben im Seiten-Baukasten das gemeinsame Feld „Wohnung“ (`data.property_id`). Die Auswahl und ihre Validierung erlauben nur aktive Wohnungen der Website der bearbeiteten Seite. Leer bleibt die Hauptwohnung. Ein Eintrag in [ZUSAMMENARBEIT.md](ZUSAMMENARBEIT.md) §6 wird erst fällig, wenn **neue** Bausteine dazukommen (Übersicht aller Wohnungen, Suche über mehrere) – diese gehören nicht zum Kern und brauchen eine Pflicht-Vorlage im Basis-Theme.
|
||||
|
||||
Anzufassen wären vermutlich:
|
||||
Die Umsetzung:
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| `app/Themes/Theme.php` | `property()` merkt sich die Wohnung (`$this->property`, `$this->propertyResolved`). Für Phase 7 braucht es einen Weg, sie je Baustein zu setzen und danach zurückzusetzen – am ehesten ein `runForProperty(Property $p, Closure $c)` nach dem Vorbild von `TenantContext::run()`. **Achtung:** eine solche Methode gibt es heute nicht – ein Test, der sie voraussetzt, schlägt fehl. |
|
||||
| `app/Themes/Sections/*` | Gemeinsames Feld „Wohnung" im Admin-Formular der Bausteine, leer = Hauptwohnung. |
|
||||
| Seiten-Renderer | Setzt die Wohnung, bevor der Baustein läuft. |
|
||||
| `app/Themes/Theme.php` | `runForProperty(?Property, callable)` setzt die Wohnung für einen Callback und stellt im `finally` beide bisherigen Cache-Werte wieder her, auch bei Verschachtelung oder Fehlern. |
|
||||
| `app/Themes/SectionRegistry.php`, `PageForm` | Gemeinsames Auswahlfeld für jeden Baustein. Der Renderer prüft Website-Zugehörigkeit und Aktivität erneut; fremde, inaktive oder gelöschte Zuordnungen werden übersprungen, ohne auf eine andere Wohnung umzulenken. |
|
||||
| `app/Themes/SectionView.php` | Die Ausgabe bleibt verzögert (`render()` wie bisher). Auch während Blade, Partials und Livewire laufen, ist die gewählte Wohnung aktiv; das gilt ebenso für die Bildwelt über den Theme-Kontext. Danach gilt wieder der vorherige Zustand. |
|
||||
|
||||
Tests: `tests/Feature/SectionPropertyTest.php` prüft in 13 Fällen gemischte Wohnungen auf einer Seite, Hauptwohnungs-Fallback, das Buchungsformular, verzögerte Ausgabe, verschachtelte Kontexte und Fehler sowie Speichern und Ablehnen im Admin über Website- und Mandantengrenzen. Gesamte Feature-Suite: **285 Tests, 1289 Assertions grün**; Pint ausgeführt. Keine neue Tabelle, Migration oder Abhängigkeit. Deployment erfolgreich, keine Migration offen.
|
||||
|
||||
**Gitea-Workflow (26.10., noch nicht grün):** Der vorhandene Runner `v0.2.11` kann kein Node 24 ausführen. `setup-php@v2` wurde in beiden Jobs durch die geprüfte Node-20-Version `2.36.0` ersetzt; SQLite- und MariaDB-Testlauf wählen jetzt ausdrücklich `--testsuite=Feature`. Der nächste Lauf bestätigt: Checkout klappt, aber die PHP-8.4-Installation scheitert ohne Detailursache. Ausführung laut Log über `hostexecutor`; Betriebssystem und Architektur sind noch nicht belegt. Diagnose vor dem Setup ergänzt (OS, Architektur, Benutzer, PHP, APT-Kandidaten, passwortloses sudo), beide Setup-Schritte ausdrücklich auf `runner: self-hosted` gesetzt. Nächsten Lauf auswerten; Installationsursache noch offen. Weiter gilt: Push auf `main` startet Tests; Deploy nur über `v*`-Tag oder manuellen Workflow. Dieses Release wurde lokal mit `scripts/deploy.sh staging deploy` ausgeliefert.
|
||||
|
||||
**Nicht vergessen:** Jede neue Tabelle bekommt `tenant_id` von Anfang an und gehört in `TenantArchive::DELETE_ORDER`, sonst überlebt sie die Kündigung ihres Mandanten. `tests/Feature/TenantSeparationTest.php` merkt das – aber nur, wenn der Testaufbau dort die neue Tabelle auch füllt.
|
||||
|
||||
@@ -179,13 +183,14 @@ ### Ausgeliefert
|
||||
| | |
|
||||
|---|---|
|
||||
| Server | nur **stommer.info** (Staging). `www.fewo-stommer.de` ist unberührt und bleibt WordPress. |
|
||||
| Release | `20261024152057`, Git-Tag `deploy/staging/20261024152057`, Commit `2c5b5fc` (**Phasen 1–5 vollständig**). Der Tag `20261024151841` zeigt auf denselben Commit – ein Deploy wurde wiederholt, weil die erste Ausgabe durch einen Absturz verloren ging. |
|
||||
| Code danach | Commits auf `main` nach `2c5b5fc` sind Dokumentation. Sie sind nicht erneut ausgeliefert. Ein Deploy nur wegen dieser Texte ist unnötig: das Skript nimmt `docs/` nicht mit. |
|
||||
| Release | `20261026065920` (**Phasen 1–5 plus Anwendungsseite von Phase 6**). Frühere Tags desselben Tages: `20261024151841` und `20261024152057` zeigen auf denselben Commit – ein Deploy wurde wiederholt, weil die erste Ausgabe durch einen Absturz verloren ging. |
|
||||
| Code danach | Commits auf `main` nach `361acfa` sind Dokumentation. Sie sind nicht erneut ausgeliefert. Ein Deploy nur wegen dieser Texte ist unnötig: das Skript nimmt `docs/` nicht mit. |
|
||||
| Migration | fünf Migrationen vom 23.10. sind auf der MariaDB von stommer.info durch. Vorhandene Zeilen gehören zum Mandanten **Stommer** (`slug` `stommer`); die Betriebsdaten stehen an dessen Spalten, `settings` ist weg. Ein zweites Migrieren legt keinen zweiten Stommer an, solange keine Zeile ohne Mandant übrig ist. |
|
||||
| Sicherung davor | `C:\Dev\fewo-backups\staging\20261024-171534`; davor `…\20261024-102031`, `…\20261024-092543` und `…\20261023-215553` (die letzte mit noch vorhandener `settings`-Tabelle). Erstellt mit `scripts/backup-pull.sh staging`. Ein Rollback der Version nimmt die Migration **nicht** zurück. |
|
||||
| Sicherung davor | `C:\Dev\fewo-backups\staging\20261026-075730`; davor `…\20261024-171534`, `…\20261024-102031`, `…\20261024-092543` und `…\20261023-215553` (die letzte mit noch vorhandener `settings`-Tabelle). Erstellt mit `scripts/backup-pull.sh staging`. Ein Rollback der Version nimmt die Migration **nicht** zurück. |
|
||||
| Konto | `php artisan users:promote-operator lars@stommer.com` ist auf dem Server gelaufen. Passwort und 2FA sind gleich geblieben. |
|
||||
| Prüfung | `https://stommer.info/`, `/wohnung` und `/buchen` antworten 200 und zeigen weiter Seebad und Stommer samt Vermieterdaten aus den Mandanten-Spalten. `/admin` und `/betreiber` leiten ohne Anmeldung auf die Login-Seite um (302). Betriebsart Testbetrieb, Umleitung an `lars@stommer.com`. **Noch nicht angemeldet geprüft:** die Seite System › Betrieb mit den neuen Abschnitten. |
|
||||
| Prüfung (24.10., nach Phase 4/5) | `/`, `/wohnung`, `/buchen` auf beiden Hosts 200; `/admin` und `/betreiber` 302. `bookings:expire-holds` läuft nachweislich **je Mandant** („Stommer: 0 …“, „Testmandant (Probe): 0 …“). `tenants:export testmandant` einmal auf dem Server ausgeführt; Exporte landen über den Symlink in `shared/storage/app/private/exports` (überleben jeden Deploy) und sind aus dem Web mit 403 gesperrt. **Nicht geprüft:** `tenants:delete` auf echten Daten – es löscht Dateien. |
|
||||
| Prüfung (26.10., nach Phase 6) | `/`, `/wohnung`, `/buchen` auf beiden Hosts 200 und weiter Inhalte von Stommer; `/admin` und `/betreiber` 302. `image-worlds:check` meldet die Bildwelt `ostsee` mit 11 Plätzen. Spalten `image_world` sind leer, also greift die Vorgabe der Installation: `$theme->imageWorld()` liefert `ostsee`, `$theme->motif(‚divider‘)` ein SVG von 1897 Zeichen mit `aria-hidden`. `$theme->brand(‘logo‘)` ist null – es wurde noch kein Logo hochgeladen, der Vertrag bleibt dadurch wie bisher. |
|
||||
|
||||
Die lokale Datei `database/database.sqlite` (`.env`: `DB_CONNECTION=sqlite`, `APP_URL=http://localhost:8000`) ist **nicht** vollständig migriert (die zwei Migrationen von Phase 3 stehen dort auf „Pending“). `php artisan serve` auf diesem Rechner trifft das alte Schema und läuft mit dem neuen Code nicht. Testinstanz ist stommer.info. Die lokale Datei nur migrieren, wenn jemand bewusst lokal arbeiten will (`php artisan migrate`, danach `users:promote-operator` für das lokale Konto). Die `.env` nicht auf die Datenbank von stommer.info zeigen lassen.
|
||||
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\UserRole;
|
||||
use App\Filament\Resources\Pages\Pages\EditPage;
|
||||
use App\Models\Page;
|
||||
use App\Models\Property;
|
||||
use App\Models\Site;
|
||||
use App\Models\User;
|
||||
use App\Tenancy\TenantContext;
|
||||
use App\Themes\SectionRegistry;
|
||||
use App\Themes\Theme;
|
||||
use App\Themes\ThemeFactory;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Livewire\Livewire;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use RuntimeException;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SectionPropertyTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_sections_use_the_selected_property_and_return_to_the_primary_property(): void
|
||||
{
|
||||
$this->withoutVite();
|
||||
$site = Site::factory()->create(['domain' => 'wohnungen.test', 'is_default' => true]);
|
||||
Property::factory()->for($site)->create(['name' => 'Hauptwohnung', 'size_sqm' => 53]);
|
||||
$second = Property::factory()->for($site)->create(['name' => 'Bergwohnung', 'size_sqm' => 87]);
|
||||
Page::factory()->for($site)->create([
|
||||
'slug' => Page::HOME,
|
||||
'sections' => [
|
||||
['type' => 'facts', 'data' => ['heading' => 'Erste Wohnung']],
|
||||
['type' => 'facts', 'data' => ['heading' => 'Zweite Wohnung', 'property_id' => (string) $second->id]],
|
||||
['type' => 'facts', 'data' => ['heading' => 'Wieder Hauptwohnung', 'property_id' => null]],
|
||||
['type' => 'booking', 'data' => ['property_id' => $second->id]],
|
||||
],
|
||||
]);
|
||||
|
||||
$this->get('http://wohnungen.test/')
|
||||
->assertOk()
|
||||
->assertSeeInOrder(['Erste Wohnung', '53 m²', 'Zweite Wohnung', '87 m²', 'Wieder Hauptwohnung', '53 m²'])
|
||||
->assertSee('"propertyId":'.$second->id, false);
|
||||
|
||||
$this->assertSame('Hauptwohnung', app(Theme::class)->property()->name);
|
||||
}
|
||||
|
||||
public function test_deferred_views_and_partials_see_the_selected_theme_property(): void
|
||||
{
|
||||
$site = Site::factory()->create();
|
||||
$primary = Property::factory()->for($site)->create(['name' => 'Hauptwohnung']);
|
||||
$second = Property::factory()->for($site)->create(['name' => 'Bergwohnung']);
|
||||
$theme = app(ThemeFactory::class)->forSite($site)->activate();
|
||||
app()->instance(Theme::class, $theme);
|
||||
View::composer('theme::sections.facts', function ($view): void {
|
||||
$view->with('heading', $view->getData()['theme']->property()->name.' / '.app(Theme::class)->property()->name);
|
||||
});
|
||||
|
||||
$sections = app(SectionRegistry::class)->render($theme, [
|
||||
['type' => 'facts', 'data' => ['property_id' => $second->id]],
|
||||
['type' => 'facts', 'data' => []],
|
||||
]);
|
||||
|
||||
$this->assertSame($primary->id, $theme->property()->id);
|
||||
$this->assertStringContainsString('Bergwohnung / Bergwohnung', $sections[0]->render());
|
||||
$this->assertStringContainsString('Hauptwohnung / Hauptwohnung', $sections[1]->render());
|
||||
$this->assertSame($primary->id, $theme->property()->id);
|
||||
}
|
||||
|
||||
public function test_nested_property_contexts_restore_the_unresolved_primary_cache_after_an_exception(): void
|
||||
{
|
||||
$site = Site::factory()->create();
|
||||
$primary = Property::factory()->for($site)->create();
|
||||
$second = Property::factory()->for($site)->create();
|
||||
$theme = app(ThemeFactory::class)->forSite($site);
|
||||
|
||||
try {
|
||||
$theme->runForProperty($second, function () use ($theme, $primary, $second): void {
|
||||
$this->assertSame($second->id, $theme->property()->id);
|
||||
$theme->runForProperty($primary, function () use ($theme, $primary): void {
|
||||
$this->assertSame($primary->id, $theme->property()->id);
|
||||
});
|
||||
$this->assertSame($second->id, $theme->property()->id);
|
||||
|
||||
throw new RuntimeException('Abbruch');
|
||||
});
|
||||
$this->fail('The callback must throw.');
|
||||
} catch (RuntimeException $exception) {
|
||||
$this->assertSame('Abbruch', $exception->getMessage());
|
||||
}
|
||||
|
||||
$primary->update(['is_active' => false]);
|
||||
$this->assertSame($second->id, $theme->property()->id);
|
||||
}
|
||||
|
||||
public function test_a_failing_deferred_view_restores_the_primary_property(): void
|
||||
{
|
||||
$site = Site::factory()->create();
|
||||
$primary = Property::factory()->for($site)->create();
|
||||
$second = Property::factory()->for($site)->create();
|
||||
$theme = app(ThemeFactory::class)->forSite($site)->activate();
|
||||
$sections = app(SectionRegistry::class)->render($theme, [
|
||||
['type' => 'facts', 'data' => ['property_id' => $second->id]],
|
||||
]);
|
||||
View::composer('theme::sections.facts', function () use ($theme, $second): void {
|
||||
$this->assertSame($second->id, $theme->property()->id);
|
||||
|
||||
throw new RuntimeException('Vorlage abgebrochen');
|
||||
});
|
||||
|
||||
try {
|
||||
$sections[0]->render();
|
||||
$this->fail('The view must throw.');
|
||||
} catch (RuntimeException $exception) {
|
||||
$this->assertSame('Vorlage abgebrochen', $exception->getMessage());
|
||||
}
|
||||
|
||||
$this->assertSame($primary->id, $theme->property()->id);
|
||||
}
|
||||
|
||||
/** @return array<string, array{string}> */
|
||||
public static function invalidPropertyProvider(): array
|
||||
{
|
||||
return [
|
||||
'other website of same tenant' => ['other_site'],
|
||||
'other tenant' => ['other_tenant'],
|
||||
'inactive property' => ['inactive'],
|
||||
'deleted property' => ['deleted'],
|
||||
];
|
||||
}
|
||||
|
||||
#[DataProvider('invalidPropertyProvider')]
|
||||
public function test_invalid_property_assignments_are_skipped(string $kind): void
|
||||
{
|
||||
$site = Site::factory()->create();
|
||||
Property::factory()->for($site)->create();
|
||||
$otherSite = Site::factory()->create(['tenant_id' => $site->tenant_id]);
|
||||
$property = match ($kind) {
|
||||
'other_site' => Property::factory()->for($otherSite)->create(),
|
||||
'other_tenant' => Property::factory()->for(Site::factory())->create(),
|
||||
default => Property::factory()->for($site)->create(['is_active' => false]),
|
||||
};
|
||||
if ($kind === 'deleted') {
|
||||
$property->delete();
|
||||
}
|
||||
app(TenantContext::class)->set($site->tenant);
|
||||
$theme = app(ThemeFactory::class)->forSite($site)->activate();
|
||||
|
||||
$sections = app(SectionRegistry::class)->render($theme, [
|
||||
['type' => 'facts', 'data' => ['property_id' => $property->id]],
|
||||
['type' => 'facts', 'data' => ['heading' => 'Hauptwohnung bleibt sichtbar']],
|
||||
]);
|
||||
|
||||
$this->assertCount(1, $sections);
|
||||
$this->assertStringContainsString('Hauptwohnung bleibt sichtbar', $sections[0]->render());
|
||||
}
|
||||
|
||||
public function test_editor_saves_a_property_of_the_pages_website(): void
|
||||
{
|
||||
$site = Site::factory()->create();
|
||||
$property = Property::factory()->for($site)->create();
|
||||
$page = Page::factory()->for($site)->create();
|
||||
$user = User::factory()->role(UserRole::Content)->create();
|
||||
$user->tenants()->syncWithoutDetaching([$site->tenant_id => ['role' => UserRole::Content->value]]);
|
||||
app(TenantContext::class)->set($site->tenant);
|
||||
$this->actingAs($user);
|
||||
|
||||
Livewire::test(EditPage::class, ['record' => $page->getRouteKey()])
|
||||
->fillForm(['sections' => [['type' => 'facts', 'data' => ['property_id' => $property->id]]]])
|
||||
->call('save')
|
||||
->assertHasNoFormErrors();
|
||||
|
||||
$this->assertSame($property->id, (int) $page->fresh()->sections[0]['data']['property_id']);
|
||||
}
|
||||
|
||||
#[DataProvider('invalidPropertyProvider')]
|
||||
public function test_editor_rejects_properties_outside_the_available_selection(string $kind): void
|
||||
{
|
||||
$site = Site::factory()->create();
|
||||
$page = Page::factory()->for($site)->create(['sections' => []]);
|
||||
$otherSite = Site::factory()->create(['tenant_id' => $site->tenant_id]);
|
||||
$property = match ($kind) {
|
||||
'other_site' => Property::factory()->for($otherSite)->create(),
|
||||
'other_tenant' => Property::factory()->for(Site::factory())->create(),
|
||||
default => Property::factory()->for($site)->create(['is_active' => false]),
|
||||
};
|
||||
if ($kind === 'deleted') {
|
||||
$property->delete();
|
||||
}
|
||||
$user = User::factory()->role(UserRole::Content)->create();
|
||||
$user->tenants()->syncWithoutDetaching([$site->tenant_id => ['role' => UserRole::Content->value]]);
|
||||
app(TenantContext::class)->set($site->tenant);
|
||||
$this->actingAs($user);
|
||||
|
||||
Livewire::test(EditPage::class, ['record' => $page->getRouteKey()])
|
||||
->fillForm(['sections' => [['type' => 'facts', 'data' => ['property_id' => $property->id]]]])
|
||||
->call('save')
|
||||
->assertHasFormErrors();
|
||||
|
||||
$this->assertSame([], $page->fresh()->sections);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user