242 lines
10 KiB
Markdown
242 lines
10 KiB
Markdown
|
|
# Resume – Rentman Clone (abgeschlossener Stand)
|
|||
|
|
|
|||
|
|
> **Letzte Aktualisierung:** 2026-05-31 13:10
|
|||
|
|
> **Zuständiger Agent:** A0 Software Orchestrator
|
|||
|
|
> **Nächster Agent kann nahtlos fortfahren.**
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Projektübersicht
|
|||
|
|
**Ziel:** Vollständiger Nachbau von Rentman.io (Cloud-basierte Vermietungs- und Event-Management-Plattform) mit ≥90 % Funktionsumfang.
|
|||
|
|
**Ansatz:** Projektzentrisch – jedes Modul gehört zu einem Projekt.
|
|||
|
|
**Status:** Implementierungsphase (plan_mode: implementation_allowed).
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Bisheriger Fortschritt
|
|||
|
|
|
|||
|
|
### ✅ Abgeschlossene Phasen (0–2)
|
|||
|
|
| Phase | Tasks | Inhalt |
|
|||
|
|
|-------|-------|--------|
|
|||
|
|
| 0 – Foundation | T001–T003 | Projektstruktur, Docker Compose, FastAPI-Grundgerüst, React-Frontend mit Vite/Tailwind/Router/Zustand |
|
|||
|
|
| 1 – Auth-System | T004–T008 | Account/User/Role-Modelle, JWT-Auth (Login/Register/Refresh), RBAC-Middleware, Admin-API für User & Roles, Login/Register/Admin-UI |
|
|||
|
|
| 2 – Contacts & Tags | T009–T011 | Contact- und Tag-Modelle mit M2M, CRUD-API für Contacts (mit Suche, Typfilter, Tags), Tags-API, Contacts-UI (Liste, Formular, Detailseite) |
|
|||
|
|
|
|||
|
|
### 🔜 Nächste Phase (3) – Equipment Catalog
|
|||
|
|
| Task | Beschreibung |
|
|||
|
|
|------|-------------|
|
|||
|
|
| T012 | Datenbankmodelle: Equipment, StockLocation, EquipmentGroup (M2M) |
|
|||
|
|
| T013 | Equipment-CRUD-API mit Suche, Filter, Barcode/QR-Generierung, CSV-Import/Export |
|
|||
|
|
| T014 | Equipment-UI: Liste (Grid/Table-Toggle), Detailseite, Formular, Barcode-Druck |
|
|||
|
|
|
|||
|
|
**Offene Tasks:** T012–T020 (Equipment, Crew, Vehicles), T021+ (Projektmanagement), Finanzen, Scheduling, Reporting, PWA etc. (siehe `todo.md` und `task_graph.json`).
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Technologie-Stack
|
|||
|
|
|
|||
|
|
### Backend (`/backend`)
|
|||
|
|
- **Framework:** FastAPI (Python 3.12+, async)
|
|||
|
|
- **ORM:** SQLAlchemy 2.0 (async engine mit aiosqlite für Dev)
|
|||
|
|
- **Migrationen:** Alembic (render_as_batch für SQLite)
|
|||
|
|
- **Auth:** JWT (python-jose) + Passwort-Hashing (passlib bcrypt)
|
|||
|
|
- **Config:** Pydantic Settings (`.env` / `.env.example`)
|
|||
|
|
- **Datenbank:** SQLite (`backend/data/rentman.db`) für Dev, PostgreSQL 16 für Prod geplant
|
|||
|
|
- **Task Queue:** Celery + Redis (später)
|
|||
|
|
- **Datei-Storage:** MinIO (Docker)
|
|||
|
|
|
|||
|
|
### Frontend (`/frontend`)
|
|||
|
|
- **Framework:** React 19 + TypeScript
|
|||
|
|
- **Build:** Vite
|
|||
|
|
- **Styling:** Tailwind CSS 4 + Radix UI Primitives
|
|||
|
|
- **State Management:** Zustand (Auth-Store) + TanStack React Query (API-Daten)
|
|||
|
|
- **Routing:** React Router 7
|
|||
|
|
- **HTTP-Client:** Axios mit Interceptor (Access-Token, Auto-Refresh)
|
|||
|
|
- **Icons:** Lucide React
|
|||
|
|
|
|||
|
|
### Infrastruktur
|
|||
|
|
- **Docker Compose:** Services: backend, frontend, redis, minio
|
|||
|
|
- **Makefile:** Befehle: `dev`, `backend-dev`, `frontend-dev`, `migrate`, etc.
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Projektstruktur
|
|||
|
|
```
|
|||
|
|
rentman-clone/
|
|||
|
|
├── backend/
|
|||
|
|
│ ├── app/
|
|||
|
|
│ │ ├── main.py # FastAPI-App, Lifespan, CORS
|
|||
|
|
│ │ ├── core/
|
|||
|
|
│ │ │ ├── config.py # Settings
|
|||
|
|
│ │ │ └── security.py # JWT + bcrypt
|
|||
|
|
│ │ ├── db/
|
|||
|
|
│ │ │ ├── base.py # SQLAlchemy Base
|
|||
|
|
│ │ │ └── session.py # AsyncEngine + Session
|
|||
|
|
│ │ ├── models/ # SQLAlchemy-Modelle
|
|||
|
|
│ │ │ ├── account.py
|
|||
|
|
│ │ │ ├── user.py
|
|||
|
|
│ │ │ ├── role.py
|
|||
|
|
│ │ │ ├── contact.py # + Tag M2M
|
|||
|
|
│ │ │ └── tag.py
|
|||
|
|
│ │ ├── schemas/ # Pydantic-Schemas
|
|||
|
|
│ │ │ ├── auth.py
|
|||
|
|
│ │ │ ├── user.py
|
|||
|
|
│ │ │ ├── role.py
|
|||
|
|
│ │ │ └── contact.py
|
|||
|
|
│ │ ├── api/v1/
|
|||
|
|
│ │ │ ├── router.py # Registriert alle Sub-Router
|
|||
|
|
│ │ │ ├── health.py
|
|||
|
|
│ │ │ ├── auth.py
|
|||
|
|
│ │ │ ├── users.py
|
|||
|
|
│ │ │ ├── roles.py
|
|||
|
|
│ │ │ ├── contacts.py
|
|||
|
|
│ │ │ └── tags.py
|
|||
|
|
│ │ └── api/deps.py # Dependency: get_current_user, require_permission
|
|||
|
|
│ ├── alembic/
|
|||
|
|
│ │ ├── env.py # Async + Batch
|
|||
|
|
│ │ └── versions/ # Migrationen
|
|||
|
|
│ ├── data/ # SQLite-DB
|
|||
|
|
│ ├── requirements.txt
|
|||
|
|
│ ├── Dockerfile
|
|||
|
|
│ └── .env.example
|
|||
|
|
├── frontend/
|
|||
|
|
│ ├── src/
|
|||
|
|
│ │ ├── main.tsx # Einstieg, QueryClient, Router
|
|||
|
|
│ │ ├── App.tsx # Routing
|
|||
|
|
│ │ ├── components/
|
|||
|
|
│ │ │ ├── AppLayout.tsx # Sidebar, Header, Navigation
|
|||
|
|
│ │ │ ├── ProtectedRoute.tsx
|
|||
|
|
│ │ │ └── ContactForm.tsx
|
|||
|
|
│ │ ├── pages/
|
|||
|
|
│ │ │ ├── Home.tsx
|
|||
|
|
│ │ │ ├── Login.tsx
|
|||
|
|
│ │ │ ├── Register.tsx
|
|||
|
|
│ │ │ ├── Dashboard.tsx
|
|||
|
|
│ │ │ ├── Users.tsx # Admin
|
|||
|
|
│ │ │ ├── Roles.tsx # Admin
|
|||
|
|
│ │ │ ├── Contacts.tsx
|
|||
|
|
│ │ │ ├── ContactsNew.tsx
|
|||
|
|
│ │ │ ├── ContactsEdit.tsx
|
|||
|
|
│ │ │ └── ContactDetail.tsx
|
|||
|
|
│ │ ├── services/
|
|||
|
|
│ │ │ └── api.ts # Axios-Client mit Token-Interceptor
|
|||
|
|
│ │ ├── stores/
|
|||
|
|
│ │ │ └── authStore.ts # Zustand Auth-Store (persistiert)
|
|||
|
|
│ │ └── lib/
|
|||
|
|
│ │ └── utils.ts # cn()-Funktion
|
|||
|
|
│ ├── package.json
|
|||
|
|
│ ├── vite.config.ts
|
|||
|
|
│ └── Dockerfile
|
|||
|
|
├── docker-compose.yml
|
|||
|
|
├── Makefile
|
|||
|
|
├── README.md
|
|||
|
|
└── .a0/ # Orchestrator-Artefakte
|
|||
|
|
├── project_state.json
|
|||
|
|
├── requirements.md
|
|||
|
|
├── architecture.md
|
|||
|
|
├── design.md
|
|||
|
|
├── task_graph.json
|
|||
|
|
├── decisions.md
|
|||
|
|
├── todo.md
|
|||
|
|
├── worklog.md
|
|||
|
|
├── current_status.md
|
|||
|
|
├── next_steps.md
|
|||
|
|
├── known_errors.md
|
|||
|
|
└── resume.md ← DIESE DATEI
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Wichtige Code-Patterns & Konventionen
|
|||
|
|
|
|||
|
|
### Backend
|
|||
|
|
1. **Model → Schema → Router → Frontend:** Dieses Pattern für jedes neue Modul verwenden.
|
|||
|
|
2. **Tenant-Isolation:** Alle Datenbankabfragen müssen `account_id`-Filter enthalten. Der aktuelle User wird aus der JWT extrahiert (`get_current_user`) und liefert `current_user.account_id`.
|
|||
|
|
3. **RBAC:** Jeder Endpunkt mit `require_permission("<resource>:<action>")` schützen. Vorhandene Permissions: `users:read/write/delete`, `roles:read/write`, `contacts:read/write/delete`, `tags:read/write`, `equipment:*` (noch zu vergeben).
|
|||
|
|
4. **UUIDs:** Alle Primärschlüssel sind UUIDs (Python `uuid.uuid4()`).
|
|||
|
|
5. **Migrationen:** Mit `alembic revision --autogenerate` erstellen, `render_as_batch=True` in env.py beachten. Nach Erstellung im `versions/`-Ordner manuell anpassen.
|
|||
|
|
6. **API-Paginierung:** Standard: `limit` und `offset` als Query-Parameter, Antwort mit `items`-Array und `total`-Count.
|
|||
|
|
|
|||
|
|
### Frontend
|
|||
|
|
1. **Auth-Store:** `authStore` enthält `token`, `user`, `isAuthenticated`. Bei Login/Refresh gespeichert, bei Logout gelöscht.
|
|||
|
|
2. **API-Client:** `services/api.ts` Axios-Instanz mit `baseURL`, Access-Token-Interceptor (fügt `Authorization`-Header hinzu) und 401-Auto-Refresh (ruft `/auth/refresh` auf).
|
|||
|
|
3. **Protected Route:** `<ProtectedRoute permission="...">` kapselt Zugriffsschutz. Umleitet auf `/login` wenn nicht authentifiziert, zeigt Fehler wenn Permission fehlt.
|
|||
|
|
4. **React Query:** Für Datenabrufe `useQuery`, für Mutationen `useMutation` verwenden (z.B. `useMutation({ mutationFn: ... })`).
|
|||
|
|
5. **Tailwind:** Utility-Klassen verwenden, keine eigenen CSS-Dateien. Theme-Farben im `index.css` definiert.
|
|||
|
|
6. **Neue Seiten:** In `App.tsx` Route hinzufügen, ggf. mit ProtectedRoute. Sidebar-Links in `AppLayout.tsx` ergänzen.
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Startanweisungen
|
|||
|
|
|
|||
|
|
### Voraussetzungen
|
|||
|
|
- Docker und Docker Compose installiert
|
|||
|
|
- Python 3.12+, Node.js 22+
|
|||
|
|
|
|||
|
|
### Entwicklung starten
|
|||
|
|
```bash
|
|||
|
|
cd /a0/usr/workdir/dev-projects/rentman-clone
|
|||
|
|
|
|||
|
|
# Abhängigkeiten installieren
|
|||
|
|
make install-backend # pip install -r backend/requirements.txt
|
|||
|
|
make install-frontend # npm install
|
|||
|
|
|
|||
|
|
# Backend starten (uvicorn auf Port 8000)
|
|||
|
|
make backend-dev
|
|||
|
|
|
|||
|
|
# Frontend starten (Vite auf Port 5173)
|
|||
|
|
make frontend-dev
|
|||
|
|
|
|||
|
|
# Oder alles mit Docker:
|
|||
|
|
docker compose up
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### Datenbank-Migrationen
|
|||
|
|
```bash
|
|||
|
|
cd backend
|
|||
|
|
# Neue Migration erzeugen
|
|||
|
|
alembic revision --autogenerate -m "beschreibung"
|
|||
|
|
# Migration anwenden
|
|||
|
|
alembic upgrade head
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### API testen
|
|||
|
|
```bash
|
|||
|
|
# Registrierung
|
|||
|
|
curl -X POST http://localhost:8000/api/v1/auth/register \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-d '{"account_name":"Testfirma", "full_name":"Admin", "email":"admin@test.de", "password":"test123"}'
|
|||
|
|
|
|||
|
|
# Login
|
|||
|
|
curl -X POST http://localhost:8000/api/v1/auth/login \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-d '{"email":"admin@test.de", "password":"test123"}'
|
|||
|
|
|
|||
|
|
# Mit Token
|
|||
|
|
curl http://localhost:8000/api/v1/auth/me \
|
|||
|
|
-H "Authorization: Bearer <access_token>"
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Offene Punkte & Bekannte Einschränkungen
|
|||
|
|
|
|||
|
|
- **Keine automatischen Tests** vorhanden (später hinzufügen).
|
|||
|
|
- **SQLite-Spezifika:** Einige PostgreSQL-Features (z.B. JSON-Felder in SQLite als Text) müssen bei Migration beachtet werden.
|
|||
|
|
- **Image-Upload:** Noch nicht implementiert (Equipment-Bilder, Logos).
|
|||
|
|
- **Frontend-Seiten** für Equipment, Crew, Vehicles, Projects, Finanzen etc. fehlen noch.
|
|||
|
|
- **Auth-Flows** wie Passwort-Reset und E-Mail-Verifikation fehlen.
|
|||
|
|
- **Internationalisierung** (i18n) nicht begonnen (DE+EN geplant).
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Nächste Aktion für neuen Agenten
|
|||
|
|
1. **.a0/resume.md** (diese Datei) lesen, dann **.a0/project_state.json**, **.a0/task_graph.json**, **.a0/next_steps.md** und **.a0/requirements.md**.
|
|||
|
|
2. **Plan Mode** prüfen: ist `implementation_allowed`.
|
|||
|
|
3. **Phase 3 starten** mit Task **T012**: Equipment-Datenbankmodelle (models/equipment.py, StockLocation, EquipmentGroup), wie in `design.md` und `architecture.md` beschrieben.
|
|||
|
|
4. Anschließend T013 (API) und T014 (UI).
|
|||
|
|
5. Bei Problemen `known_errors.md` prüfen und ggf. erweitern.
|
|||
|
|
6. Alle Änderungen in `.a0/`-Dateien dokumentieren (worklog, todo, current_status, next_steps).
|
|||
|
|
|
|||
|
|
**Viel Erfolg! 🚀**
|