docs: update AGENTS.md and DIRECTUS-SCHEMA.md with crypto namespacing, chat polling, buyer_user field and notification flow

This commit is contained in:
2026-02-11 11:27:41 +01:00
parent 227791e8f9
commit f164b833bf
2 changed files with 38 additions and 8 deletions

View File

@@ -146,6 +146,7 @@ locales/
- **Font-Family**: `var(--font-family)` für Body, `var(--font-family-heading)` für Headlines
- **Border-Radius**: `var(--radius-sm|md|lg|xl|full)`
- **Breakpoint**: `@media (max-width: 768px)` - einziger Mobile-Breakpoint für alle Komponenten
- **Kontrast-Text**: `var(--color-success-text)` für Text auf Success-Hintergrund (Light: `#fff`, Dark: `#042F2E`)
### i18n
- Schlüssel: `section.key` (z.B. `home.title`)
@@ -159,7 +160,7 @@ locales/
1. **SSH funktioniert nicht** mit diesem Repo auf gitea.pro - HTTPS mit Token nutzen
2. **Service Worker** kann lokale Änderungen cachen - bei Problemen Cache leeren
3. **i18n muss vor Shell laden** - siehe `app.js` (dynamischer Import)
4. **E2E Chat**: Per-listing Keypairs (nicht Account-Key) für Seller-Identität. Listing braucht `contact_public_key` Feld in Directus. TOFU Key-Pinning warnt bei Schlüsseländerung. Conversations/Messages nur über User-Rolle zugänglich (kein Public-Zugriff).
4. **E2E Chat**: Per-listing Keypairs (nicht Account-Key) für Seller-Identität. Listing braucht `contact_public_key` Feld in Directus. TOFU Key-Pinning warnt bei Schlüsseländerung. Conversations/Messages nur über User-Rolle zugänglich (kein Public-Zugriff). Crypto-Storage ist per Account namespaced (`kashilo_kp_<hash>`, `kashilo_salt_<hash>`, `kashilo_lk_<hash>`) — unterstützt mehrere Accounts im selben Browser, Migration vom alten Format automatisch. Chat-Widget pollt alle 5s nach neuen Nachrichten wenn geöffnet. Conversations haben ein `buyer_user` Feld (UUID, FK → directus_users).
## Nächste Schritte
@@ -202,7 +203,7 @@ locales/
| `categories_translations` | ✓ | - | - | Für i18n |
| `locations` | ✓ | ✓ | - | User kann neue Orte anlegen |
| `languages` | ✓ | - | - | Für Sprachen-Liste |
| `conversations` | - | - | - | **Nur User-Rolle** (Auth-Pflicht, kein Public-Zugriff) |
| `conversations` | - | - | | **Nur User-Rolle** (Auth-Pflicht, kein Public-Zugriff). Update: `buyer_user` Feld |
| `messages` | - | - | - | **Nur User-Rolle** (Auth-Pflicht, kein Public-Zugriff) |
| `favorites` | ✓ | ✓ | - | User-Rolle: Filter `user = $CURRENT_USER`, Delete erlaubt |
| `notifications` | ✓ | ✓ (via Flow/Webhook) | ✓ | User-Rolle: Filter `user_hash`, nur `read` updaten |
@@ -214,8 +215,8 @@ locales/
| Flow | Trigger | Aktion |
|------|---------|--------|
| Archive Expired Listings | Schedule `*/15 * * * *` | `status → archived` wenn `expires_at < NOW` |
| Notify: Listing Published | Webhook (btcpay-webhook.php) | Creates notification when listing is published after payment |
| Notify: New Message | Event Hook `items.create` on `messages` | Creates notification for message recipient |
| ~~Notify: Listing Published~~ | ~~Webhook~~ | **Deaktiviert** — wird jetzt direkt von `btcpay-webhook.php` gehandhabt (mit Duplikat-Check) |
| Notify: New Message | Event Hook `items.create` on `messages` | Read Data (Conversation + Listing) → Run Script (Empfänger ermitteln) → Condition → Create Data (Notification). Benötigt `$full` Permissions auf Read Data und Create Data |
Siehe `docs/DIRECTUS-SCHEMA.md` für vollständiges Schema.