Merge remote changes and update project files
This commit is contained in:
268
setup/PRODUCTS_COLLECTION_SCHEMA.md
Normal file
268
setup/PRODUCTS_COLLECTION_SCHEMA.md
Normal file
@@ -0,0 +1,268 @@
|
||||
# Products Collection Schema
|
||||
|
||||
Diese Datei beschreibt alle Attribute, die in der `products` Collection benötigt werden, damit das Programm funktioniert.
|
||||
|
||||
## Collection: `products`
|
||||
|
||||
**Collection ID:** `products` (oder über `VITE_APPWRITE_PRODUCTS_COLLECTION_ID` konfiguriert)
|
||||
|
||||
## Erforderliche Attribute
|
||||
|
||||
### 1. `product_account_id` (String, Required)
|
||||
- **Typ:** String
|
||||
- **Required:** Ja
|
||||
- **Verwendung:**
|
||||
- Filterung nach Account (Query.equal)
|
||||
- Verknüpfung zu Accounts-Collection
|
||||
- **Beispiel:** `"account_123"`
|
||||
|
||||
### 2. `product_platform` (Enum, Required)
|
||||
- **Typ:** Enum
|
||||
- **Required:** Ja
|
||||
- **Werte:** `["amazon", "ebay"]`
|
||||
- **Verwendung:**
|
||||
- Speichert die Plattform (aktuell nur "ebay" wird verwendet)
|
||||
- **Beispiel:** `"ebay"`
|
||||
|
||||
### 3. `product_platform_market` (String, Required)
|
||||
- **Typ:** String
|
||||
- **Required:** Ja
|
||||
- **Verwendung:**
|
||||
- Speichert den Marktplatz (z.B. "DE", "US", "UK")
|
||||
- Wird aus Account abgeleitet
|
||||
- **Beispiel:** `"DE"`, `"US"`, `"UK"`
|
||||
|
||||
### 4. `product_platform_product_id` (String, Required, Unique)
|
||||
- **Typ:** String
|
||||
- **Required:** Ja
|
||||
- **Unique:** Ja (für Duplikat-Prüfung)
|
||||
- **Verwendung:**
|
||||
- Eindeutige Produkt-ID von der Plattform (z.B. eBay Item-ID)
|
||||
- Wird für Duplikat-Prüfung verwendet
|
||||
- Wird für Mapping zwischen Extension und Datenbank verwendet
|
||||
- **Beispiel:** `"123456789"` (eBay Item-ID)
|
||||
|
||||
### 5. `product_title` (String, Optional)
|
||||
- **Typ:** String
|
||||
- **Required:** Nein
|
||||
- **Verwendung:**
|
||||
- Produkttitel
|
||||
- Wird für Anzeige in UI verwendet
|
||||
- Wird für Suchfilter verwendet (client-side)
|
||||
- **Beispiel:** `"iPhone 13 Pro Max 256GB"`
|
||||
|
||||
### 6. `product_price` (Float, Optional)
|
||||
- **Typ:** Float
|
||||
- **Required:** Nein
|
||||
- **Verwendung:**
|
||||
- Produktpreis
|
||||
- Wird für KPI-Berechnungen verwendet (Durchschnittspreis)
|
||||
- Wird für Price Spread Insights verwendet
|
||||
- **Beispiel:** `99.99`
|
||||
|
||||
### 7. `product_currency` (String, Optional)
|
||||
- **Typ:** String
|
||||
- **Required:** Nein
|
||||
- **Verwendung:**
|
||||
- Währung (z.B. "EUR", "USD", "GBP")
|
||||
- Wird aus Market abgeleitet, falls nicht vorhanden
|
||||
- **Beispiel:** `"EUR"`, `"USD"`, `"GBP"`
|
||||
|
||||
### 8. `product_url` (String, Optional)
|
||||
- **Typ:** String
|
||||
- **Required:** Nein
|
||||
- **Verwendung:**
|
||||
- URL zum Produkt auf der Plattform
|
||||
- **Beispiel:** `"https://www.ebay.de/itm/123456789"`
|
||||
|
||||
### 9. `product_status` (Enum, Optional)
|
||||
- **Typ:** Enum
|
||||
- **Required:** Nein
|
||||
- **Werte:** `["active", "ended", "unknown"]`
|
||||
- **Verwendung:**
|
||||
- Status des Produkts
|
||||
- Wird für Filterung verwendet (Overview KPIs, Products Page)
|
||||
- Wird für Status-Filter in UI verwendet
|
||||
- **Default:** `"unknown"`
|
||||
- **Beispiel:** `"active"`, `"ended"`, `"unknown"`
|
||||
|
||||
### 10. `product_category` (String, Optional)
|
||||
- **Typ:** String
|
||||
- **Required:** Nein
|
||||
- **Verwendung:**
|
||||
- Produktkategorie
|
||||
- Wird für Category Share Insights verwendet
|
||||
- **Default:** `"unknown"`
|
||||
- **Beispiel:** `"Electronics"`, `"Clothing"`
|
||||
|
||||
### 11. `product_condition` (String, Optional)
|
||||
- **Typ:** String
|
||||
- **Required:** Nein
|
||||
- **Verwendung:**
|
||||
- Zustand des Produkts (z.B. "New", "Used")
|
||||
- **Default:** `"unknown"`
|
||||
- **Beispiel:** `"New"`, `"Used"`, `"Refurbished"`
|
||||
|
||||
## Standard-Appwrite-Felder
|
||||
|
||||
Diese Felder werden automatisch von Appwrite bereitgestellt:
|
||||
|
||||
- **`$id`** (String, Required) - Eindeutige Dokument-ID
|
||||
- **`$createdAt`** (DateTime, Required) - Erstellungsdatum (wird für Sortierung verwendet)
|
||||
- **`$updatedAt`** (DateTime, Required) - Aktualisierungsdatum
|
||||
|
||||
## Indexes (Empfohlen)
|
||||
|
||||
Für bessere Performance sollten folgende Indexes erstellt werden:
|
||||
|
||||
1. **Index auf `product_account_id`** (für Filterung)
|
||||
- Attribute: `product_account_id`
|
||||
- Typ: Key
|
||||
|
||||
2. **Index auf `product_platform_product_id`** (für Duplikat-Prüfung)
|
||||
- Attribute: `product_platform_product_id`
|
||||
- Typ: Unique Key
|
||||
|
||||
3. **Index auf `product_account_id` + `$createdAt`** (für Sortierung)
|
||||
- Attribute: `product_account_id`, `$createdAt`
|
||||
- Typ: Composite
|
||||
|
||||
## Berechtigungen
|
||||
|
||||
Die Collection benötigt folgende Berechtigungen:
|
||||
|
||||
- **Read:** Authenticated Users
|
||||
- **Create:** Authenticated Users
|
||||
- **Update:** Authenticated Users
|
||||
- **Delete:** Authenticated Users (optional, falls Löschen benötigt wird)
|
||||
|
||||
## Appwrite CLI Befehle zum Erstellen
|
||||
|
||||
```bash
|
||||
# Collection erstellen
|
||||
appwrite databases createCollection \
|
||||
--database-id eship-db \
|
||||
--collection-id products \
|
||||
--name "Products"
|
||||
|
||||
# Attribute erstellen
|
||||
appwrite databases createStringAttribute \
|
||||
--database-id eship-db \
|
||||
--collection-id products \
|
||||
--key product_account_id \
|
||||
--required true \
|
||||
--size 255
|
||||
|
||||
appwrite databases createEnumAttribute \
|
||||
--database-id eship-db \
|
||||
--collection-id products \
|
||||
--key product_platform \
|
||||
--elements amazon ebay \
|
||||
--required true
|
||||
|
||||
appwrite databases createStringAttribute \
|
||||
--database-id eship-db \
|
||||
--collection-id products \
|
||||
--key product_platform_market \
|
||||
--required true \
|
||||
--size 10
|
||||
|
||||
appwrite databases createStringAttribute \
|
||||
--database-id eship-db \
|
||||
--collection-id products \
|
||||
--key product_platform_product_id \
|
||||
--required true \
|
||||
--size 255
|
||||
|
||||
appwrite databases createStringAttribute \
|
||||
--database-id eship-db \
|
||||
--collection-id products \
|
||||
--key product_title \
|
||||
--required false \
|
||||
--size 500
|
||||
|
||||
appwrite databases createFloatAttribute \
|
||||
--database-id eship-db \
|
||||
--collection-id products \
|
||||
--key product_price \
|
||||
--required false
|
||||
|
||||
appwrite databases createStringAttribute \
|
||||
--database-id eship-db \
|
||||
--collection-id products \
|
||||
--key product_currency \
|
||||
--required false \
|
||||
--size 10
|
||||
|
||||
appwrite databases createStringAttribute \
|
||||
--database-id eship-db \
|
||||
--collection-id products \
|
||||
--key product_url \
|
||||
--required false \
|
||||
--size 1000
|
||||
|
||||
appwrite databases createEnumAttribute \
|
||||
--database-id eship-db \
|
||||
--collection-id products \
|
||||
--key product_status \
|
||||
--elements active ended unknown \
|
||||
--required false
|
||||
|
||||
appwrite databases createStringAttribute \
|
||||
--database-id eship-db \
|
||||
--collection-id products \
|
||||
--key product_category \
|
||||
--required false \
|
||||
--size 255
|
||||
|
||||
appwrite databases createStringAttribute \
|
||||
--database-id eship-db \
|
||||
--collection-id products \
|
||||
--key product_condition \
|
||||
--required false \
|
||||
--size 100
|
||||
|
||||
# Indexes erstellen
|
||||
appwrite databases createIndex \
|
||||
--database-id eship-db \
|
||||
--collection-id products \
|
||||
--key idx_account_id \
|
||||
--type key \
|
||||
--attributes product_account_id
|
||||
|
||||
appwrite databases createIndex \
|
||||
--database-id eship-db \
|
||||
--collection-id products \
|
||||
--key idx_platform_product_id \
|
||||
--type unique \
|
||||
--attributes product_platform_product_id
|
||||
|
||||
appwrite databases createIndex \
|
||||
--database-id eship-db \
|
||||
--collection-id products \
|
||||
--key idx_account_created \
|
||||
--type key \
|
||||
--attributes product_account_id $createdAt
|
||||
```
|
||||
|
||||
## Zusammenfassung
|
||||
|
||||
**Erforderliche Attribute (Required):**
|
||||
1. `product_account_id` (String)
|
||||
2. `product_platform` (Enum: ["amazon", "ebay"])
|
||||
3. `product_platform_market` (String)
|
||||
4. `product_platform_product_id` (String, Unique)
|
||||
|
||||
**Optionale Attribute:**
|
||||
5. `product_title` (String)
|
||||
6. `product_price` (Float)
|
||||
7. `product_currency` (String)
|
||||
8. `product_url` (String)
|
||||
9. `product_status` (Enum: ["active", "ended", "unknown"])
|
||||
10. `product_category` (String)
|
||||
11. `product_condition` (String)
|
||||
|
||||
**Standard-Felder (automatisch):**
|
||||
- `$id` (String)
|
||||
- `$createdAt` (DateTime)
|
||||
- `$updatedAt` (DateTime)
|
||||
78
setup/PRODUCTS_SCAN_TROUBLESHOOTING.md
Normal file
78
setup/PRODUCTS_SCAN_TROUBLESHOOTING.md
Normal file
@@ -0,0 +1,78 @@
|
||||
# Products Scan Fehlerbehebung
|
||||
|
||||
## Fehler: "Parsing failed (unknown)"
|
||||
|
||||
Dieser Fehler kann zwei Ursachen haben:
|
||||
|
||||
### 1. Extension-Fehler (Parsing failed)
|
||||
|
||||
**Symptome:**
|
||||
- Fehlermeldung: `Extension-Fehler: Parsing failed (unknown)`
|
||||
- Die Extension kann keine Produkte auf der eBay-Seite finden
|
||||
|
||||
**Mögliche Ursachen:**
|
||||
- Die Account-URL zeigt nicht auf eine Seite mit Produkt-Listings
|
||||
- Die eBay-Seite hat sich geändert und die Extension-Selektoren funktionieren nicht mehr
|
||||
- Die Seite ist noch nicht vollständig geladen
|
||||
|
||||
**Lösung:**
|
||||
- Stelle sicher, dass die Account-URL auf eine Seite mit Produkt-Listings zeigt (z.B. `/str/` Storefront oder `/usr/` Seller Profile mit Items)
|
||||
- Versuche die Extension neu zu laden
|
||||
- Prüfe die Browser-Konsole für weitere Details
|
||||
|
||||
### 2. Datenbank-Fehler (Collection/Attribute fehlt)
|
||||
|
||||
**Symptome:**
|
||||
- Fehlermeldung: `Datenbank-Fehler: Products-Collection existiert nicht` oder
|
||||
- Fehlermeldung: `Datenbank-Fehler: Ein Attribut fehlt oder ist ungültig`
|
||||
|
||||
**Mögliche Ursachen:**
|
||||
- Die `products` Collection wurde noch nicht erstellt
|
||||
- Die Collection existiert, aber es fehlen erforderliche Attribute
|
||||
- Die Berechtigungen für die Collection sind nicht korrekt konfiguriert
|
||||
|
||||
**Lösung:**
|
||||
|
||||
1. **Prüfe ob die Collection existiert:**
|
||||
```bash
|
||||
appwrite databases listCollections --database-id eship-db
|
||||
```
|
||||
|
||||
2. **Erstelle die Collection falls sie fehlt:**
|
||||
- Öffne die Appwrite-Konsole
|
||||
- Navigiere zu Databases → eship-db → Collections
|
||||
- Erstelle eine neue Collection mit ID: `products`
|
||||
|
||||
3. **Erstelle die erforderlichen Attribute:**
|
||||
Die Collection benötigt folgende Attribute:
|
||||
- `product_account_id` (string, required)
|
||||
- `product_platform` (enum: ["amazon", "ebay"], required)
|
||||
- `product_platform_market` (string, required)
|
||||
- `product_platform_product_id` (string, required, unique)
|
||||
- `product_title` (string)
|
||||
- `product_price` (float)
|
||||
- `product_currency` (string)
|
||||
- `product_url` (string)
|
||||
- `product_status` (enum: ["active", "ended", "unknown"])
|
||||
- `product_category` (string)
|
||||
- `product_condition` (string)
|
||||
|
||||
4. **Prüfe die Berechtigungen:**
|
||||
- Die Collection muss Lese- und Schreibrechte für authentifizierte Benutzer haben
|
||||
|
||||
## Fehler: "ERR_CONNECTION_REFUSED" auf Port 7242
|
||||
|
||||
Dieser Fehler ist **nicht kritisch** und kann ignoriert werden. Es handelt sich um einen Debug-Logging-Versuch, der fehlschlägt, weil kein Server auf Port 7242 läuft. Dies hat keinen Einfluss auf die Funktionalität.
|
||||
|
||||
## Diagnose-Schritte
|
||||
|
||||
1. **Prüfe die Browser-Konsole** für detaillierte Fehlermeldungen
|
||||
2. **Prüfe ob die Extension geladen ist:**
|
||||
- Öffne `chrome://extensions/`
|
||||
- Stelle sicher, dass die Extension aktiviert ist
|
||||
3. **Prüfe die Datenbank-Struktur:**
|
||||
- Verwende die Appwrite-Konsole oder CLI
|
||||
- Stelle sicher, dass die `products` Collection existiert
|
||||
4. **Teste die Account-URL:**
|
||||
- Öffne die Account-URL manuell im Browser
|
||||
- Stelle sicher, dass Produkt-Listings sichtbar sind
|
||||
328
setup/create-products-collection.ps1
Normal file
328
setup/create-products-collection.ps1
Normal file
@@ -0,0 +1,328 @@
|
||||
# PowerShell Script zum Erstellen der Products Collection
|
||||
# Erstellt die Collection mit allen erforderlichen Attributen
|
||||
|
||||
$ErrorActionPreference = "Continue"
|
||||
|
||||
Write-Host "=== Products Collection Setup ===" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# Konfiguration
|
||||
$DATABASE_ID = "eship-db"
|
||||
$COLLECTION_ID = "products"
|
||||
$COLLECTION_NAME = "Products"
|
||||
|
||||
# 1. Prüfe Login-Status
|
||||
Write-Host "1. Prüfe Appwrite Login-Status..." -ForegroundColor Yellow
|
||||
$loginCheck = appwrite databases list 2>&1
|
||||
|
||||
if ($LASTEXITCODE -ne 0 -and $loginCheck -like "*Session not found*") {
|
||||
Write-Host " [WARNUNG] Nicht eingeloggt. Bitte zuerst einloggen:" -ForegroundColor Red
|
||||
Write-Host " appwrite login" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host " Führe diesen Befehl jetzt aus..." -ForegroundColor Yellow
|
||||
appwrite login
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# 2. Erstelle Collection
|
||||
Write-Host "2. Erstelle Collection '$COLLECTION_ID'..." -ForegroundColor Yellow
|
||||
$createCollection = appwrite databases createCollection `
|
||||
--database-id $DATABASE_ID `
|
||||
--collection-id $COLLECTION_ID `
|
||||
--name $COLLECTION_NAME `
|
||||
--document-security false `
|
||||
2>&1
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " [OK] Collection '$COLLECTION_ID' erfolgreich erstellt!" -ForegroundColor Green
|
||||
} else {
|
||||
if ($createCollection -like "*already exists*" -or $createCollection -like "*duplicate*") {
|
||||
Write-Host " [INFO] Collection '$COLLECTION_ID' existiert bereits." -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host " [FEHLER] Fehler beim Erstellen der Collection:" -ForegroundColor Red
|
||||
Write-Host " $createCollection" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
|
||||
# 3. Erstelle Attribute
|
||||
Write-Host "3. Erstelle Attribute..." -ForegroundColor Yellow
|
||||
|
||||
# 3.1 product_account_id (String, Required)
|
||||
Write-Host " 3.1 product_account_id..." -ForegroundColor Gray
|
||||
$attr1 = appwrite databases createStringAttribute `
|
||||
--database-id $DATABASE_ID `
|
||||
--collection-id $COLLECTION_ID `
|
||||
--key product_account_id `
|
||||
--required true `
|
||||
--size 255 `
|
||||
2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " [OK] product_account_id erstellt" -ForegroundColor Green
|
||||
} else {
|
||||
if ($attr1 -like "*already exists*" -or $attr1 -like "*duplicate*") {
|
||||
Write-Host " [INFO] product_account_id existiert bereits" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host " [WARNUNG] $attr1" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# 3.2 product_platform (Enum, Required)
|
||||
Write-Host " 3.2 product_platform..." -ForegroundColor Gray
|
||||
$attr2 = appwrite databases createEnumAttribute `
|
||||
--database-id $DATABASE_ID `
|
||||
--collection-id $COLLECTION_ID `
|
||||
--key product_platform `
|
||||
--elements amazon ebay `
|
||||
--required true `
|
||||
2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " [OK] product_platform erstellt" -ForegroundColor Green
|
||||
} else {
|
||||
if ($attr2 -like "*already exists*" -or $attr2 -like "*duplicate*") {
|
||||
Write-Host " [INFO] product_platform existiert bereits" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host " [WARNUNG] $attr2" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# 3.3 product_platform_market (String, Required)
|
||||
Write-Host " 3.3 product_platform_market..." -ForegroundColor Gray
|
||||
$attr3 = appwrite databases createStringAttribute `
|
||||
--database-id $DATABASE_ID `
|
||||
--collection-id $COLLECTION_ID `
|
||||
--key product_platform_market `
|
||||
--required true `
|
||||
--size 10 `
|
||||
2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " [OK] product_platform_market erstellt" -ForegroundColor Green
|
||||
} else {
|
||||
if ($attr3 -like "*already exists*" -or $attr3 -like "*duplicate*") {
|
||||
Write-Host " [INFO] product_platform_market existiert bereits" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host " [WARNUNG] $attr3" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# 3.4 product_platform_product_id (String, Required)
|
||||
Write-Host " 3.4 product_platform_product_id..." -ForegroundColor Gray
|
||||
$attr4 = appwrite databases createStringAttribute `
|
||||
--database-id $DATABASE_ID `
|
||||
--collection-id $COLLECTION_ID `
|
||||
--key product_platform_product_id `
|
||||
--required true `
|
||||
--size 255 `
|
||||
2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " [OK] product_platform_product_id erstellt" -ForegroundColor Green
|
||||
} else {
|
||||
if ($attr4 -like "*already exists*" -or $attr4 -like "*duplicate*") {
|
||||
Write-Host " [INFO] product_platform_product_id existiert bereits" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host " [WARNUNG] $attr4" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# 3.5 product_title (String, Optional)
|
||||
Write-Host " 3.5 product_title..." -ForegroundColor Gray
|
||||
$attr5 = appwrite databases createStringAttribute `
|
||||
--database-id $DATABASE_ID `
|
||||
--collection-id $COLLECTION_ID `
|
||||
--key product_title `
|
||||
--required false `
|
||||
--size 500 `
|
||||
2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " [OK] product_title erstellt" -ForegroundColor Green
|
||||
} else {
|
||||
if ($attr5 -like "*already exists*" -or $attr5 -like "*duplicate*") {
|
||||
Write-Host " [INFO] product_title existiert bereits" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host " [WARNUNG] $attr5" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# 3.6 product_price (Float, Optional)
|
||||
Write-Host " 3.6 product_price..." -ForegroundColor Gray
|
||||
$attr6 = appwrite databases createFloatAttribute `
|
||||
--database-id $DATABASE_ID `
|
||||
--collection-id $COLLECTION_ID `
|
||||
--key product_price `
|
||||
--required false `
|
||||
2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " [OK] product_price erstellt" -ForegroundColor Green
|
||||
} else {
|
||||
if ($attr6 -like "*already exists*" -or $attr6 -like "*duplicate*") {
|
||||
Write-Host " [INFO] product_price existiert bereits" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host " [WARNUNG] $attr6" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# 3.7 product_currency (String, Optional)
|
||||
Write-Host " 3.7 product_currency..." -ForegroundColor Gray
|
||||
$attr7 = appwrite databases createStringAttribute `
|
||||
--database-id $DATABASE_ID `
|
||||
--collection-id $COLLECTION_ID `
|
||||
--key product_currency `
|
||||
--required false `
|
||||
--size 10 `
|
||||
2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " [OK] product_currency erstellt" -ForegroundColor Green
|
||||
} else {
|
||||
if ($attr7 -like "*already exists*" -or $attr7 -like "*duplicate*") {
|
||||
Write-Host " [INFO] product_currency existiert bereits" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host " [WARNUNG] $attr7" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# 3.8 product_url (String, Optional)
|
||||
Write-Host " 3.8 product_url..." -ForegroundColor Gray
|
||||
$attr8 = appwrite databases createStringAttribute `
|
||||
--database-id $DATABASE_ID `
|
||||
--collection-id $COLLECTION_ID `
|
||||
--key product_url `
|
||||
--required false `
|
||||
--size 1000 `
|
||||
2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " [OK] product_url erstellt" -ForegroundColor Green
|
||||
} else {
|
||||
if ($attr8 -like "*already exists*" -or $attr8 -like "*duplicate*") {
|
||||
Write-Host " [INFO] product_url existiert bereits" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host " [WARNUNG] $attr8" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# 3.9 product_status (Enum, Optional)
|
||||
Write-Host " 3.9 product_status..." -ForegroundColor Gray
|
||||
$attr9 = appwrite databases createEnumAttribute `
|
||||
--database-id $DATABASE_ID `
|
||||
--collection-id $COLLECTION_ID `
|
||||
--key product_status `
|
||||
--elements active ended unknown `
|
||||
--required false `
|
||||
2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " [OK] product_status erstellt" -ForegroundColor Green
|
||||
} else {
|
||||
if ($attr9 -like "*already exists*" -or $attr9 -like "*duplicate*") {
|
||||
Write-Host " [INFO] product_status existiert bereits" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host " [WARNUNG] $attr9" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# 3.10 product_category (String, Optional)
|
||||
Write-Host " 3.10 product_category..." -ForegroundColor Gray
|
||||
$attr10 = appwrite databases createStringAttribute `
|
||||
--database-id $DATABASE_ID `
|
||||
--collection-id $COLLECTION_ID `
|
||||
--key product_category `
|
||||
--required false `
|
||||
--size 255 `
|
||||
2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " [OK] product_category erstellt" -ForegroundColor Green
|
||||
} else {
|
||||
if ($attr10 -like "*already exists*" -or $attr10 -like "*duplicate*") {
|
||||
Write-Host " [INFO] product_category existiert bereits" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host " [WARNUNG] $attr10" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# 3.11 product_condition (String, Optional)
|
||||
Write-Host " 3.11 product_condition..." -ForegroundColor Gray
|
||||
$attr11 = appwrite databases createStringAttribute `
|
||||
--database-id $DATABASE_ID `
|
||||
--collection-id $COLLECTION_ID `
|
||||
--key product_condition `
|
||||
--required false `
|
||||
--size 100 `
|
||||
2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " [OK] product_condition erstellt" -ForegroundColor Green
|
||||
} else {
|
||||
if ($attr11 -like "*already exists*" -or $attr11 -like "*duplicate*") {
|
||||
Write-Host " [INFO] product_condition existiert bereits" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host " [WARNUNG] $attr11" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "4. Erstelle Indexes..." -ForegroundColor Yellow
|
||||
|
||||
# 4.1 Index auf product_account_id
|
||||
Write-Host " 4.1 Index auf product_account_id..." -ForegroundColor Gray
|
||||
$idx1 = appwrite databases createIndex `
|
||||
--database-id $DATABASE_ID `
|
||||
--collection-id $COLLECTION_ID `
|
||||
--key idx_account_id `
|
||||
--type key `
|
||||
--attributes product_account_id `
|
||||
2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " [OK] Index idx_account_id erstellt" -ForegroundColor Green
|
||||
} else {
|
||||
if ($idx1 -like "*already exists*" -or $idx1 -like "*duplicate*") {
|
||||
Write-Host " [INFO] Index idx_account_id existiert bereits" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host " [WARNUNG] $idx1" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# 4.2 Unique Index auf product_platform_product_id
|
||||
Write-Host " 4.2 Unique Index auf product_platform_product_id..." -ForegroundColor Gray
|
||||
$idx2 = appwrite databases createIndex `
|
||||
--database-id $DATABASE_ID `
|
||||
--collection-id $COLLECTION_ID `
|
||||
--key idx_platform_product_id `
|
||||
--type unique `
|
||||
--attributes product_platform_product_id `
|
||||
2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " [OK] Index idx_platform_product_id erstellt" -ForegroundColor Green
|
||||
} else {
|
||||
if ($idx2 -like "*already exists*" -or $idx2 -like "*duplicate*") {
|
||||
Write-Host " [INFO] Index idx_platform_product_id existiert bereits" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host " [WARNUNG] $idx2" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# 4.3 Composite Index auf product_account_id + $createdAt
|
||||
Write-Host " 4.3 Composite Index auf product_account_id + `$createdAt..." -ForegroundColor Gray
|
||||
$idx3 = appwrite databases createIndex `
|
||||
--database-id $DATABASE_ID `
|
||||
--collection-id $COLLECTION_ID `
|
||||
--key idx_account_created `
|
||||
--type key `
|
||||
--attributes product_account_id `$createdAt `
|
||||
2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " [OK] Index idx_account_created erstellt" -ForegroundColor Green
|
||||
} else {
|
||||
if ($idx3 -like "*already exists*" -or $idx3 -like "*duplicate*") {
|
||||
Write-Host " [INFO] Index idx_account_created existiert bereits" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host " [WARNUNG] $idx3" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "=== Setup abgeschlossen ===" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host "Nächste Schritte:" -ForegroundColor Cyan
|
||||
Write-Host "1. Prüfe die Berechtigungen in der Appwrite-Konsole" -ForegroundColor White
|
||||
Write-Host "2. Stelle sicher, dass authentifizierte Benutzer Read/Write-Rechte haben" -ForegroundColor White
|
||||
Write-Host "3. Teste die Collection mit einem Produkt-Scan" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Reference in New Issue
Block a user