feat: implement tenant OAuth flow and guest achievements
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# API-Nutzung der Tenant Admin App
|
||||
# API-Nutzung der Tenant Admin App
|
||||
|
||||
Diese Dokumentation beschreibt alle API-Endpunkte, die die Tenant Admin App mit der Backend-Hauptapp kommuniziert. Alle Requests sind tenant-scoped und erfordern JWT-Authentifizierung.
|
||||
|
||||
@@ -19,6 +19,7 @@ Diese Dokumentation beschreibt alle API-Endpunkte, die die Tenant Admin App mit
|
||||
- **Response**: Neuer Access/Refresh-Token
|
||||
|
||||
- **Token Validation**: `GET /api/v1/tenant/me`
|
||||
- **Redirect URI**: Standardmaessig `${origin}/admin/auth/callback` (per Vite-Env anpassbar)
|
||||
- **Headers**: `Authorization: Bearer {access_token}`
|
||||
- **Response**: `{ id, email, tenant_id, role, name }`
|
||||
|
||||
@@ -51,18 +52,18 @@ Diese Dokumentation beschreibt alle API-Endpunkte, die die Tenant Admin App mit
|
||||
- **Validierung**: Prüft Credit-Balance (1 Credit pro Event)
|
||||
|
||||
### Event-Details
|
||||
- **GET /api/v1/tenant/events/{id}**
|
||||
- **GET /api/v1/tenant/events/{slug}**
|
||||
- **Headers**: `Authorization: Bearer {token}`
|
||||
- **Response**: Erweitertes Event mit `{ tasks[], members, stats { likes, views, uploads } }`
|
||||
|
||||
### Event updaten
|
||||
- **PATCH /api/v1/tenant/events/{id}**
|
||||
- **PATCH /api/v1/tenant/events/{slug}**
|
||||
- **Headers**: `Authorization: Bearer {token}`, `Content-Type: application/json`, `If-Match: {etag}`
|
||||
- **Body**: Partial Event-Daten (title, date, location, description)
|
||||
- **Response**: Updated Event
|
||||
|
||||
### Event archivieren
|
||||
- **DELETE /api/v1/tenant/events/{id}**
|
||||
- **DELETE /api/v1/tenant/events/{slug}**
|
||||
- **Headers**: `Authorization: Bearer {token}`, `If-Match: {etag}`
|
||||
- **Response**: 204 No Content (soft-delete)
|
||||
|
||||
@@ -156,12 +157,26 @@ Diese Dokumentation beschreibt alle API-Endpunkte, die die Tenant Admin App mit
|
||||
- **Response**: `{ balance: number }`
|
||||
|
||||
### Ledger-Verlauf
|
||||
- **GET /api/v1/tenant/ledger**
|
||||
- **GET /api/v1/tenant/credits/ledger**
|
||||
- **Headers**: `Authorization: Bearer {token}`
|
||||
- **Params**: `page`, `per_page` (Pagination)
|
||||
- **Response**: `{ data: LedgerEntry[], current_page, last_page }`
|
||||
- **LedgerEntry**: `{ id, type, amount, credits, date, description, transactionId? }`
|
||||
|
||||
### Credits kaufen (In-App)
|
||||
- **POST /api/v1/tenant/credits/purchase**
|
||||
- **Headers**: `Authorization: Bearer {token}`, `Content-Type: application/json`
|
||||
- **Body**: `{ package_id: string, credits_added: number, platform?: 'capacitor'|'web', transaction_id?: string, subscription_active?: boolean }`
|
||||
- **Response**: `{ message, balance, subscription_active }`
|
||||
- **Hinweis**: Wird nach erfolgreichen In-App-Kuferfolgen aufgerufen, aktualisiert Balance & Ledger.
|
||||
|
||||
### Credits synchronisieren
|
||||
- **POST /api/v1/tenant/credits/sync**
|
||||
- **Headers**: `Authorization: Bearer {token}`, `Content-Type: application/json`
|
||||
- **Body**: `{ balance: number, subscription_active: boolean, last_sync: ISODateString }`
|
||||
- **Response**: `{ balance, subscription_active, server_time }`
|
||||
- **Hinweis**: Client meldet lokalen Stand; Server gibt Quelle-der-Wahrheit zurcck.
|
||||
|
||||
### Kauf-Intent erstellen
|
||||
- **POST /api/v1/tenant/purchases/intent**
|
||||
- **Headers**: `Authorization: Bearer {token}`, `Content-Type: application/json`
|
||||
@@ -242,8 +257,9 @@ curl -H "Authorization: Bearer {token}" \
|
||||
## Deployment
|
||||
|
||||
### Environment-Variablen
|
||||
- **REACT_APP_API_URL**: Backend-API-URL (Pflicht)
|
||||
- **REACT_APP_OAUTH_CLIENT_ID**: OAuth-Client-ID (Pflicht)
|
||||
- **VITE_API_URL**: Backend-API-URL (Pflicht)
|
||||
- **VITE_OAUTH_CLIENT_ID**: OAuth-Client-ID (Pflicht)
|
||||
- **VITE_REVENUECAT_PUBLIC_KEY**: Optional fuer In-App-Kaeufe (RevenueCat)
|
||||
|
||||
### Build & Deploy
|
||||
1. **Development**: `npm run dev`
|
||||
@@ -254,4 +270,5 @@ curl -H "Authorization: Bearer {token}" \
|
||||
- App ist PWA-fähig (Manifest, Service Worker).
|
||||
- Installierbar auf Desktop/Mobile via "Zum Startbildschirm hinzufügen".
|
||||
|
||||
Für weitere Details siehe die spezifischen Dokumentationsdateien.
|
||||
Für weitere Details siehe die spezifischen Dokumentationsdateien.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user