feat: merge home/search pages, add filters/sorting/infinite scroll, nearby sort with IP fallback

This commit is contained in:
2026-02-04 11:39:42 +01:00
parent 96538ab1db
commit de0f3628ce
11 changed files with 765 additions and 298 deletions

197
docs/DIRECTUS-SCHEMA.md Normal file
View File

@@ -0,0 +1,197 @@
# Directus Schema Documentation
**Directus Version:** 11.14.1
**Database:** PostgreSQL
**API Endpoint:** https://api.dgray.io
## Collections Overview
| Collection | Beschreibung |
|------------|--------------|
| `listings` | Haupttabelle für Anzeigen |
| `listings_files` | Junction-Table für Listing-Bilder |
| `categories` | Kategorien mit Übersetzungen |
| `categories_translations` | Kategorie-Übersetzungen (i18n) |
| `locations` | Standorte für Anzeigen |
| `languages` | Verfügbare Sprachen |
| `conversations` | Chat-Konversationen |
| `messages` | Chat-Nachrichten |
| `favorites` | Favoriten (User-Listing Relation) |
| `reports` | Meldungen/Beschwerden |
---
## listings
Haupttabelle für alle Anzeigen.
| Feld | Typ | Beschreibung |
|------|-----|--------------|
| `id` | UUID | Primary Key |
| `status` | string | `draft`, `published`, `archived` |
| `sort` | integer | Sortierung |
| `title` | string | Titel der Anzeige |
| `slug` | string | URL-freundlicher Titel |
| `description` | text | Beschreibung |
| `price` | decimal | Preis |
| `currency` | string | Währung: `EUR`, `CHF`, `USD`, `XMR` |
| `price_mode` | string | `fiat` oder `xmr` (Referenzwährung) |
| `price_type` | string | `fixed`, `negotiable`, `free` |
| `condition` | string | `new`, `like_new`, `good`, `fair`, `poor` |
| `shipping` | boolean | Versand möglich |
| `shipping_cost` | decimal | Versandkosten |
| `views` | integer | Aufrufzähler |
| `expires_at` | datetime | Ablaufdatum |
| `monero_address` | string | XMR-Adresse für Zahlung |
| `date_created` | datetime | Erstellungsdatum |
| `date_updated` | datetime | Änderungsdatum |
| `user_created` | UUID | Ersteller (FK → directus_users) |
| `category` | UUID | Kategorie (FK → categories) |
| `location` | UUID | Standort (FK → locations) |
| `images` | o2m | Bilder (→ listings_files) |
---
## listings_files
Junction-Table für Listing-Bilder (Many-to-Many).
| Feld | Typ | Beschreibung |
|------|-----|--------------|
| `id` | integer | Primary Key |
| `listings_id` | UUID | FK → listings |
| `directus_files_id` | UUID | FK → directus_files |
| `sort` | integer | Sortierung der Bilder |
---
## categories
Kategorien mit hierarchischer Struktur.
| Feld | Typ | Beschreibung |
|------|-----|--------------|
| `id` | UUID | Primary Key |
| `status` | string | `draft`, `published`, `archived` |
| `sort` | integer | Sortierung |
| `name` | string | Kategorie-Name (Fallback) |
| `slug` | string | URL-freundlicher Name |
| `icon` | string | Icon (Emoji oder Icon-Name) |
| `parent` | UUID | Parent-Kategorie (FK → categories) |
| `translations` | o2m | Übersetzungen (→ categories_translations) |
---
## categories_translations
Übersetzungen für Kategorien.
| Feld | Typ | Beschreibung |
|------|-----|--------------|
| `id` | integer | Primary Key |
| `categories_id` | UUID | FK → categories |
| `languages_code` | string | Sprachcode (`de`, `en`, `fr`) |
| `name` | string | Übersetzter Name |
---
## locations
Standorte für Anzeigen.
| Feld | Typ | Beschreibung |
|------|-----|--------------|
| `id` | UUID | Primary Key |
| `name` | string | Ortsname |
| `postal_code` | string | Postleitzahl |
| `region` | string | Region/Kanton |
| `country` | string | Land: `DE`, `AT`, `CH`, `FR`, `IT`, `LI` |
| `latitude` | float | Breitengrad |
| `longitude` | float | Längengrad |
---
## languages
Verfügbare Sprachen.
| Feld | Typ | Beschreibung |
|------|-----|--------------|
| `code` | string | Primary Key, z.B. `de`, `en`, `fr` |
| `name` | string | Sprachname |
---
## conversations
Chat-Konversationen zwischen Usern.
| Feld | Typ | Beschreibung |
|------|-----|--------------|
| `id` | UUID | Primary Key |
| `listing` | UUID | FK → listings |
| `buyer` | UUID | FK → directus_users (Interessent) |
| `seller` | UUID | FK → directus_users (Verkäufer) |
| `date_created` | datetime | Erstellungsdatum |
| `date_updated` | datetime | Letzte Nachricht |
---
## messages
Nachrichten in Konversationen.
| Feld | Typ | Beschreibung |
|------|-----|--------------|
| `id` | UUID | Primary Key |
| `conversation` | UUID | FK → conversations |
| `sender` | UUID | FK → directus_users |
| `content` | text | Verschlüsselter Inhalt |
| `date_created` | datetime | Zeitstempel |
---
## favorites
User-Favoriten.
| Feld | Typ | Beschreibung |
|------|-----|--------------|
| `id` | UUID | Primary Key |
| `user` | UUID | FK → directus_users |
| `listing` | UUID | FK → listings |
| `date_created` | datetime | Hinzugefügt am |
---
## reports
Meldungen von Anzeigen.
| Feld | Typ | Beschreibung |
|------|-----|--------------|
| `id` | UUID | Primary Key |
| `listing` | UUID | FK → listings |
| `reporter` | UUID | FK → directus_users |
| `reason` | string | Grund der Meldung |
| `description` | text | Details |
| `status` | string | `pending`, `reviewed`, `resolved` |
| `date_created` | datetime | Meldungsdatum |
---
## Public Role Permissions
| Collection | Read | Create | Update | Delete | Hinweise |
|------------|:----:|:------:|:------:|:------:|----------|
| `listings` | ✓ | ✓ | - | - | Nur `status=published` lesen |
| `listings_files` | ✓ | ✓ | - | - | Für Bilder-Upload |
| `directus_files` | ✓ | ✓ | - | - | Asset-Upload |
| `categories` | ✓ | - | - | - | Nur `status=published` |
| `categories_translations` | ✓ | - | - | - | Für i18n |
| `locations` | ✓ | ✓ | - | - | User kann neue Orte anlegen |
| `languages` | ✓ | - | - | - | Für Sprach-Auswahl |
| `conversations` | ✓ | ✓ | - | - | Nur eigene |
| `messages` | ✓ | ✓ | - | - | Nur in eigenen Konversationen |
| `favorites` | ✓ | ✓ | - | ✓ | Nur eigene |
| `reports` | - | ✓ | - | - | Nur erstellen |