INSIGHT-MVP/docs/Stand.md
Thomas Reitz 3f919340b5 feat: Stammdaten, CRM Reporting, Hilfesystem (hohe Priorität)
Stammdaten (Kapitel 14):
- 5 neue Prisma-Modelle: Department, Location, CostCenter, JobTitle, SkillCategory
- MasterDataModule (Core Service): vollständiges CRUD + öffentliche Dropdown-Endpoints
- Admin-UI /admin/master-data mit 5 Tabs, Inline-Edit, Farbwahl (Skill-Kategorien)

CRM Reporting (Kapitel 22.9):
- recharts ^2.12.0 installiert
- Deals: GET /deals/stats (Win/Loss-Rate, Umsatz, Trend, Verlustgründe)
- Aktivitäten: GET /activities/stats (nach Typ, Completion-Rate, offene Tasks)
- Reports-Seite /crm/reports: LineChart, PieChart, BarChart mit Zeitraum-Filter

Hilfesystem (Kapitel 16):
- @anthropic-ai/sdk installiert; ANTHROPIC_API_KEY optional in .env
- HelpModule (Core Service): POST /help/chat via Claude Haiku
- HelpTooltip-Komponente: Hover-Tooltip für Formularfelder
- HelpPanel: seitlicher Drawer mit Seitenkontext + KI-Chat
- -Button im Topbar (AppLayout), pageKey aus Route abgeleitet

Migration erforderlich: prisma migrate deploy (core-service)
Deployment: core rebuild, crm rebuild, frontend rebuild

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 10:39:30 +01:00

211 lines
8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# INSIGHT MVP — Aktueller Implementierungsstand
*Stand: 2026-03-15 (Update)*
---
## Alle Services live und gesund
| Service | Container | Status |
|---------|-----------|--------|
| Core Service | `insight-core` | ✅ healthy |
| CRM Service | `insight-crm` | ✅ healthy |
| Frontend | `insight-frontend` | ✅ healthy |
| PostgreSQL | `insight-postgres` | ✅ healthy |
| PgBouncer | `insight-pgbouncer` | ✅ healthy |
| Redis | `insight-redis` | ✅ healthy |
| Traefik | `insight-traefik` | ✅ healthy |
| step-ca | `insight-step-ca` | ✅ healthy |
---
## Implementierte Features (vollständig deployed)
### Auth & Benutzer
- ✅ Login (lokal + SSO via Microsoft Entra ID)
- ✅ JWT (RS256, Access in Memory, Refresh HttpOnly Cookie)
- ✅ 2FA (TOTP)
- ✅ Silent Refresh
- ✅ Passwort ändern
- ✅ Profilbild-Upload
### Microsoft 365 Integration
- ✅ OAuth2-Flow (`/auth/integrations/microsoft-365`)
- ✅ Token-Storage verschlüsselt (AES-256-GCM) in `user_integrations`
- ✅ Token-Refresh automatisch
- ✅ Scopes: Mail.Read, Calendars.Read, Tasks.ReadWrite, offline_access
- ✅ O365-Profilfelder: jobTitle, department, companyName, officeLocation
- ✅ Profilbild-Sync aus O365 (96x96, nur wenn kein INSIGHT-Avatar)
- ✅ Auto-Sync beim Login (`useO365ProfileSync` Hook)
### Dashboard
- ✅ Home-Tab: Analoguhr, 3-Tage-Wetter-Prognose, Spruch des Tages, kompakte Widgets
- ✅ E-Mail-Tab (O365 Inbox mit Lesefenster)
- ✅ Kalender-Tab (O365 Events)
- ✅ Aufgaben-Tab (O365 + CRM bidirektional)
- ✅ Kontakte-Tab (O365 + CRM verknüpft)
### CRM (Phase 12.5)
- ✅ Companies, Contacts, Deals, Activities (vollständiges CRUD)
- ✅ Pipelines & Stages
- ✅ Custom Fields
- ✅ Kanban-Board (`/crm/kanban`) mit Drag & Drop (@dnd-kit)
- ✅ Forecast-Ansicht
- ✅ Lexware Office Integration (Kontakte, Belege)
- ✅ North Data Enrichment
-**CRM Berechtigungsmodell (Phase 2.5)**:
- Sichtbarkeitsfilter OWN/TEAM/ALL pro Entity (COMPANY, CONTACT, DEAL, ACTIVITY)
- JWT enthält `tenantRole` + `department`
- ReadonlyGuard für READONLY-Rolle
- Admin-Einstellungsseite `/admin/crm-settings`
- Redis-Cache für Visibility-Settings (5 Min TTL)
### Expertenprofil
- ✅ Skills, Erfahrungen, Projekte, Zertifizierungen, Sprachen, Anhänge
- ✅ 3-Spalten-Layout
- ✅ PDF-Export (Timeline, Logo, Akzentfarbe aus Branding)
- ✅ Word-Export (DOCX)
### Profilzugriff (Admin)
-`ProfileAccessGroup` + `ProfileAccessGroupMember` Modelle
- ✅ Benutzergruppen mit canView/canExport/canEdit Berechtigungen
- ✅ Admin-UI `/admin/profile-access`:
- Tab "Gruppen": CRUD + Mitglieder verwalten
- Tab "Profile": alle User mit Aktionen (Ansehen, PDF, DOCX, Bearbeiten)
- ✅ Admin-Detailseite `/admin/profiles/:userId` (Profil im Admin-Kontext bearbeiten)
- ✅ Admin-Endpoints für alle Profil-Mutationen (`/expert-profile/admin/users/...`)
### Admin-Bereich
- ✅ Benutzerverwaltung (`/admin/users`)
- ✅ SSO-Konfiguration (`/admin/sso`)
- ✅ Externe Links (`/admin/external-links`)
-**Anpassungen (`/admin/customize`)**:
- Sidebar-Breite, Logo, Farben
- Login-Hintergrund (Farbverlauf / Einfarbig / Hintergrundbild)
- **Button-/Primärfarbe** (6 Presets, freier Color-Picker, Live-Vorschau)
- ✅ Firmendaten (`/admin/company`)
- ✅ Events (`/admin/events`)
- ✅ SSL/Domain (`/admin/ssl`)
- ✅ Profilzugriff (`/admin/profile-access`)
- ✅ CRM Sichtbarkeit (`/admin/crm-settings`)
-**Stammdaten (`/admin/master-data`)**:
- Abteilungen, Standorte, Kostenstellen, Stellenbezeichnungen, Skill-Kategorien
- Inline-Edit, Sortierung, Farbwahl (Skill-Kategorien)
- Prisma-Modelle: `departments`, `locations`, `cost_centers`, `job_titles`, `skill_categories`
- Öffentliche Dropdown-Endpoints (`/master-data/public/...`) für Frontend-Formulare
### CRM Reporting
-**Reports-Seite (`/crm/reports`)** mit recharts:
- Deals-Tab: Win/Loss-Rate, Gesamtumsatz, Ø Deal-Wert, Linechart (12-Monats-Trend), Pie (Verlustgründe), Bar (Pipeline-Stages)
- Aktivitäten-Tab: Kennzahlen-Karten, Balkendiagramm nach Typ (Gesamt vs. Abgeschlossen)
- Zeitraum-Filter: Dieser Monat / Dieses Quartal / Dieses Jahr
- Neue Backend-Endpoints: `GET /deals/stats`, `GET /activities/stats`
### Hilfesystem
-**HelpTooltip-Komponente**: Hover-Tooltip mit `❓`-Icon für Formularfelder
-**HelpPanel-Komponente**: Seitlicher Drawer mit kontextuellem Hilfetext + KI-Assistent
- Seiten-spezifische Hilfetexte (13+ Seiten definiert)
- KI-Chat via Claude Haiku (Anthropic API, `ANTHROPIC_API_KEY` in `.env`)
- Graceful Degradation: statischer Hilfetext funktioniert ohne API-Key
-**❓-Button im Topbar** (öffnet HelpPanel mit aktuellem Seitenkontext)
- ✅ Backend-Endpoint `POST /help/chat` (Core Service, JWT-geschützt)
### Login-Screen-Branding
- ✅ Dynamischer Hintergrund aus Branding-Einstellungen
- ✅ Logo auf Login-Seite (statt "INSIGHT"-Text)
- ✅ Typen: Farbverlauf, Einfarbig, Hintergrundbild (max 2MB)
- ✅ Button-/Primärfarbe: `--color-primary` CSS-Variable global dynamisch aus Branding
---
## Technische Infrastruktur
| Komponente | Version/Details |
|------------|-----------------|
| Backend | NestJS 10, TypeScript strict |
| Frontend | React 18, Vite |
| Datenbank | PostgreSQL 16, Prisma ORM |
| Cache | Redis 7 (Pub/Sub + Cache) |
| Connection Pool | PgBouncer |
| API Gateway | Traefik 3 |
| Auth | RS256 JWT, bcrypt Cost 12 |
| mTLS | step-ca (Smallstep) |
| Container | Docker Compose |
### Prisma-Schemas
- `core.schema.prisma` — User, Auth, Profile, Tenant, Integrations, ProfileAccess, **Stammdaten** (Department, Location, CostCenter, JobTitle, SkillCategory)
- `crm.schema.prisma` — CRM-Entities, Pipelines, CustomFields, Contracts, Visibility
### Neue Abhängigkeiten
- Frontend: `recharts ^2.12.0` (Charts für Reports-Seite)
- Core Service: `@anthropic-ai/sdk ^0.37.0` (KI-Hilfe-Chat)
### Branching
- Aktiver Branch: `feature/crm-service`
- ~208 Commits seit Initial
---
## API-Endpunkte (Core Service)
```
POST /api/v1/auth/login
POST /api/v1/auth/refresh
POST /api/v1/auth/logout
GET /api/v1/auth/integrations/microsoft-365 ← OAuth-Flow
GET /api/v1/auth/integrations/microsoft-365/callback
GET /api/v1/users/me
PATCH /api/v1/users/me
GET /api/v1/users/team-members
GET /api/v1/users/me/integrations
DELETE /api/v1/users/me/integrations/microsoft-365
GET /api/v1/expert-profile/me
PATCH /api/v1/expert-profile/me/skills
POST /api/v1/expert-profile/me/experiences
... (Projekte, Zertifizierungen, Sprachen, Anhänge)
GET /api/v1/expert-profile/me/export/pdf
GET /api/v1/expert-profile/me/export/docx
GET /api/v1/expert-profile/admin/users
GET /api/v1/expert-profile/admin/users/:userId
GET /api/v1/expert-profile/admin/users/:userId/export/pdf
... (alle Profil-Mutationen für Admin)
GET /api/v1/profile-access/groups
POST /api/v1/profile-access/groups
PATCH /api/v1/profile-access/groups/:id
DELETE /api/v1/profile-access/groups/:id
GET/POST/DELETE /api/v1/profile-access/groups/:id/members/:userId
GET /api/v1/settings/branding
POST /api/v1/settings/branding
GET /api/v1/settings/company
POST /api/v1/settings/company
GET /api/v1/master-data/departments (Admin)
POST /api/v1/master-data/departments
PATCH /api/v1/master-data/departments/:id
DELETE /api/v1/master-data/departments/:id
... (locations, cost-centers, job-titles, skill-categories — jeweils CRUD)
GET /api/v1/master-data/public/departments (@Public)
GET /api/v1/master-data/public/locations (@Public)
GET /api/v1/master-data/public/job-titles (@Public)
GET /api/v1/master-data/public/skill-categories (@Public)
POST /api/v1/help/chat
```
## API-Endpunkte (CRM Service)
```
Companies, Contacts, Deals, Activities, Pipelines, ... (vollständiges CRUD)
GET /api/v1/crm/deals/stats?period=YEAR
GET /api/v1/crm/activities/stats?period=YEAR
GET /api/v1/crm/visibility-settings
PUT /api/v1/crm/visibility-settings/:entity
GET /api/v1/crm/office365/emails
GET /api/v1/crm/office365/calendar
GET /api/v1/crm/office365/tasks
POST /api/v1/crm/office365/tasks
GET /api/v1/crm/office365/profile
```