161 lines
4.9 KiB
Markdown
161 lines
4.9 KiB
Markdown
# Projektstruktur - SaveTheMoment Atlas
|
|
|
|
```
|
|
SaveTheMomentAtlas/
|
|
│
|
|
├── app/ # Next.js App Router
|
|
│ ├── api/ # API Routes
|
|
│ │ └── auth/
|
|
│ │ └── [...nextauth]/ # NextAuth.js Authentication
|
|
│ │ └── route.ts
|
|
│ │
|
|
│ ├── dashboard/ # Admin Dashboard
|
|
│ │ ├── layout.tsx # Dashboard Layout mit Auth-Check
|
|
│ │ └── page.tsx # Dashboard Startseite
|
|
│ │
|
|
│ ├── driver/ # Fahrer Dashboard
|
|
│ │ ├── layout.tsx # Fahrer Layout mit Auth-Check
|
|
│ │ └── page.tsx # Fahrer Übersicht
|
|
│ │
|
|
│ ├── login/ # Admin Login
|
|
│ │ └── page.tsx
|
|
│ │
|
|
│ ├── driver-login/ # Fahrer Login
|
|
│ │ └── page.tsx
|
|
│ │
|
|
│ ├── layout.tsx # Root Layout
|
|
│ ├── page.tsx # Landing Page
|
|
│ └── globals.css # Global Styles
|
|
│
|
|
├── components/ # React Components
|
|
│ ├── DashboardContent.tsx # Admin Dashboard UI
|
|
│ └── DriverDashboard.tsx # Fahrer Dashboard UI
|
|
│
|
|
├── lib/ # Utilities & Config
|
|
│ ├── prisma.ts # Prisma Client Singleton
|
|
│ └── auth.ts # NextAuth Konfiguration
|
|
│
|
|
├── prisma/ # Datenbank
|
|
│ ├── schema.prisma # Datenbank Schema
|
|
│ └── seed.ts # Seed Script
|
|
│
|
|
├── types/ # TypeScript Type Definitions
|
|
│ └── next-auth.d.ts # NextAuth Type Extensions
|
|
│
|
|
├── .env # Umgebungsvariablen (lokal)
|
|
├── .env.example # Umgebungsvariablen Template
|
|
├── .gitignore # Git Ignore
|
|
├── next.config.mjs # Next.js Config
|
|
├── package.json # Dependencies & Scripts
|
|
├── postcss.config.mjs # PostCSS Config
|
|
├── tailwind.config.ts # Tailwind CSS Config
|
|
├── tsconfig.json # TypeScript Config
|
|
├── README.md # Haupt-Dokumentation
|
|
├── QUICKSTART.md # Schnellstart-Anleitung
|
|
└── setup.sh # Setup Script
|
|
|
|
```
|
|
|
|
## Wichtige Dateien erklärt
|
|
|
|
### Datenbank (Prisma)
|
|
|
|
- **prisma/schema.prisma**: Definiert das komplette Datenmodell
|
|
- User (Admin/Fahrer)
|
|
- Location (Standorte)
|
|
- Photobox (Inventar)
|
|
- Booking (Buchungen)
|
|
- Tour (Fahrten)
|
|
- PriceConfig (Preise pro Standort)
|
|
- Notification (Benachrichtigungen)
|
|
|
|
- **prisma/seed.ts**: Fügt Testdaten ein
|
|
- 3 Benutzer (1 Admin, 2 Fahrer)
|
|
- 5 Standorte
|
|
- 17 Fotoboxen
|
|
- Preiskonfigurationen
|
|
|
|
### Authentifizierung
|
|
|
|
- **lib/auth.ts**: NextAuth.js Konfiguration
|
|
- Credentials Provider
|
|
- Session Management
|
|
- Role-based Access Control
|
|
|
|
- **app/api/auth/[...nextauth]/route.ts**: NextAuth.js API Route
|
|
|
|
### Layouts & Pages
|
|
|
|
- **app/dashboard/**: Nur für Admins zugänglich
|
|
- **app/driver/**: Nur für Fahrer zugänglich
|
|
- Automatische Weiterleitung bei fehlender Berechtigung
|
|
|
|
### UI Components
|
|
|
|
- **DashboardContent.tsx**:
|
|
- Statistiken
|
|
- Letzte Buchungen
|
|
- Schnellzugriffe
|
|
- Navigation
|
|
|
|
- **DriverDashboard.tsx**:
|
|
- Eigene Touren
|
|
- Verfügbare Touren
|
|
- Navigation
|
|
|
|
## Datenmodell Übersicht
|
|
|
|
```
|
|
User ────┬──── Tour
|
|
└──── Notification
|
|
|
|
Location ─┬─── PriceConfig
|
|
├─── Photobox
|
|
└─── Booking
|
|
|
|
Photobox ───── Booking
|
|
|
|
Booking ────── Tour
|
|
```
|
|
|
|
## Scripts (package.json)
|
|
|
|
- `npm run dev` - Entwicklungsserver starten
|
|
- `npm run build` - Production Build erstellen
|
|
- `npm start` - Production Server starten
|
|
- `npm run db:push` - Datenbank Schema pushen
|
|
- `npm run db:studio` - Prisma Studio öffnen
|
|
- `npm run db:seed` - Testdaten einfügen
|
|
|
|
## Umgebungsvariablen
|
|
|
|
```env
|
|
DATABASE_URL # PostgreSQL Verbindung
|
|
NEXTAUTH_SECRET # Session Secret
|
|
NEXTAUTH_URL # App URL
|
|
|
|
# Später:
|
|
LEXOFFICE_API_KEY # Lexoffice Integration
|
|
GOOGLE_MAPS_API_KEY # Maps & Routing
|
|
EMAIL_HOST # E-Mail Server
|
|
EMAIL_PORT # E-Mail Port
|
|
EMAIL_USER # E-Mail Benutzername
|
|
EMAIL_PASSWORD # E-Mail Passwort
|
|
```
|
|
|
|
## Entwicklungs-Workflow
|
|
|
|
1. **Änderungen am Schema**: `prisma/schema.prisma` bearbeiten
|
|
2. **Schema pushen**: `npx prisma db push`
|
|
3. **Client regenerieren**: `npx prisma generate` (automatisch)
|
|
4. **Code anpassen**: TypeScript nutzt automatisch neue Typen
|
|
|
|
## Testing
|
|
|
|
Aktuell: Manuelle Tests mit Seed-Daten
|
|
|
|
Später geplant:
|
|
- Unit Tests (Jest)
|
|
- Integration Tests
|
|
- E2E Tests (Playwright)
|