docs(crm): briefing fuer naechste Backend-Aufgaben — Vertraege-API + Kanban + Activity-Filter

This commit is contained in:
Thomas Reitz 2026-03-12 21:17:07 +01:00
parent a55643a0dd
commit e3d254c0f9

View file

@ -3119,3 +3119,71 @@ Beide Quellen werden **parallel** abgefragt (`Promise.allSettled`). Graceful Deg
- [x] "Anreichern"-Button auf Company-Detail — POST /enrich, Suggestions-Modal (Tabelle mit Feld/Aktuell/Vorschlag/Quelle), "Uebernehmen" per PATCH
- [x] suggestions-Konvertierung: Record<field,{current,suggested,source}> → Array fuer UI
- [x] North Data API-Key in CRM-Einstellungen → Tab "Integrationen"
---
## 2026-03-12 | Frontend: Phase 2 abgeschlossen — Naechste Aufgaben fuer CRM-Backend
### Phase 2 Status: KOMPLETT
Alle vier Phase-2-Features sind backend- und frontendseitig implementiert und auf insight-dev-01 deployed.
| Phase | Backend | Frontend | Deployed |
|-------|---------|----------|---------|
| 2.1 Custom Fields | DONE | DONE | Ja |
| 2.2 CSV/Excel Import | DONE | DONE | Ja |
| 2.3 Forecasting | DONE | DONE | Ja |
| 2.4 Datenanreicherung | DONE | DONE | Ja |
Phase 3 (Microsoft 365 OAuth) ist BLOCKIERT bis Core-Service OAuth liefert.
---
### Naechste Aufgaben fuer den CRM-Backend-Entwickler
#### Prioritaet 1: Vertraege-API (Contract CRUD)
Das Datenmodell (`Contract`) ist bereits im Prisma-Schema vorhanden, aber es fehlen die Endpoints. Das Frontend hat eine `ContractsCard.tsx` die aktuell nur ein Platzhalter-UI anzeigt.
**Benoetigt:**
```
GET /api/v1/crm/companies/:id/contracts — Liste der Vertraege einer Firma
POST /api/v1/crm/companies/:id/contracts — Vertrag anlegen
PATCH /api/v1/crm/companies/:id/contracts/:cid — Vertrag bearbeiten
DELETE /api/v1/crm/companies/:id/contracts/:cid — Vertrag loeschen
```
**Contract-Felder:** title, status (DRAFT|ACTIVE|EXPIRED|CANCELLED), startDate, endDate, value (Decimal), currency (Default EUR), notes
**Response-Format:** Standard `{ success, data, meta }` wie alle anderen Endpoints.
**Frontend-Hinweis:** Die `ContractsCard.tsx` und die Typen (`Contract`, `ContractStatus`) sind bereits im Frontend definiert (`packages/frontend/src/crm/types.ts`). Nach Implementierung der Endpoints muss der Frontend-Entwickler nur noch die Hooks + API-Calls hinzufuegen.
---
#### Prioritaet 2: Kanban-Board Support (Deal-Stage-Move)
Das Backend ist bereits bereit (`PATCH /crm/deals/:id` mit `{ stageId }`). Der Frontend-Entwickler kann das Kanban-Board ohne Backend-Aenderungen implementieren.
**Kein Backend-Handlungsbedarf.**
---
#### Prioritaet 3: Activity Feed — E-Mail & Aufgaben Tabs
Die Tabs "E-Mail" und "Aufgaben" auf der Company-Detail-Seite sind aktuell disabled (Platzhalter). Fuer die E-Mail-Integration wird Phase 3 (MS 365 OAuth) benoetigt.
**Fuer Aufgaben (Tasks) ohne MS 365:**
- Task-Typ existiert bereits in `ActivityType` (`TASK`, `FOLLOWUP`)
- Das Frontend kann Aufgaben bereits anlegen/anzeigen
- Optional: `scheduledAt` + `completedAt` Filter-Endpoints (`GET /crm/activities?type=TASK&completedAt=null`)
---
### TODO Backend (naechste Session)
- [ ] Vertraege-API: `GET/POST/PATCH/DELETE /crm/companies/:id/contracts`
- [ ] Prisma-Migration: Contract-Tabelle falls noch nicht vorhanden (pruefen)
- [ ] Optional: Activity-Filter `?type=TASK` fuer Aufgaben-Tab
- [ ] Nach Implementierung: Diesen Eintrag mit "DONE" markieren und Endpoints dokumentieren