Commit graph

9 commits

Author SHA1 Message Date
Thomas Reitz
47b1938605 feat(crm): Microsoft 365 Graph-API Proxy (Phase 3.2)
- Neues GraphModule mit GraphService + GraphController
- GET /crm/contacts/:id/emails    → MS Graph Emails (Search nach Kontakt-E-Mail)
- GET /crm/contacts/:id/calendar  → Kalender-Termine (naechste 90 Tage)
- GET /crm/contacts/:id/tasks     → Microsoft To Do Listen + Aufgaben
- GraphService: JWT an Core-Service weiterleiten, M365-Token holen, Graph aufrufen
- Redis-Cache 5 Minuten fuer alle Graph-Responses
- CORE_SERVICE_URL env var + docker-compose.crm.yml Eintrag

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 22:40:31 +01:00
Thomas Reitz
63cb05d4d8 feat(crm): Phase 2.2-2.4 backend + contract files — vollständige CRM-Service Implementierung
- Phase 2.3 Forecast: probability-Feld in PipelineStage, GET /crm/deals/forecast Endpoint
- Phase 2.2 Import: ImportModule mit preview/execute/history Endpoints (CSV, XLSX, vCard)
- Phase 2.4 Enrichment: EnrichmentModule mit /enrich + /settings/integrations/north-data
- Contracts: ContractsModule mit CRUD + File-Upload Endpoints (Multer, max 25MB)
- Migrations: 20260312_contract_files, 20260312_phase23_forecast
- docker-compose.crm.yml: uploads Volume für Vertragsdokumente

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 22:06:58 +01:00
Thomas Reitz
9d496d2e53 feat(crm): integrate Lexware Office for vouchers and contact sync
Adds complete Lexware Office integration to CRM service:
- Rate-limited HTTP client (Token Bucket, 2 req/s)
- Bidirectional contact sync (manual import + ERP-push)
- Voucher caching (quotes, orders, invoices, credit notes)
- Deal-voucher linking (m:n join table with audit)
- Cron jobs: voucher refresh (4h), ERP push (30min)
- Distributed locks via Redis for job deduplication
- Health check extended with Lexware status
- Prisma schema: LexwareVoucher, DealVoucher, VoucherType enum
- Companies/Contacts/Deals services extended with Lexware data

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 20:28:41 +01:00
Thomas Reitz
c9e2c4a44c feat(crm): add PATCH endpoint for pipeline stages + HTTPS router
- New PATCH /pipelines/:id/stages/:stageId endpoint to update
  stage name, color, and sortOrder
- Added HTTPS (websecure) Traefik router for CRM service
- Both requested by frontend developer via INSIGHT-CRM.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 19:22:33 +01:00
Thomas Reitz
525fe006e9 fix(crm): add Host rule and priority to Traefik router
Core-api router with Host+PathPrefix(/api) was catching CRM requests.
Added Host rule and priority=100 to ensure CRM router takes precedence
for /api/v1/crm/* paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 17:39:51 +01:00
Thomas Reitz
a03d1d0586 fix(crm): correct Traefik middleware name to cors-api@file
The CORS middleware is named cors-api, not cors-headers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 17:38:13 +01:00
Thomas Reitz
aa5fc2e44d fix(crm): use direct postgres connection instead of pgbouncer
PgBouncer in transaction pool mode strips the search_path startup
parameter, which Prisma needs for the app_crm schema. CRM now
connects directly to PostgreSQL.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 16:34:56 +01:00
Thomas Reitz
86e5d36e98 fix(crm): correct pgbouncer port from 6432 to 5432
PgBouncer listens internally on port 5432, not 6432.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 16:30:23 +01:00
Thomas Reitz
8783d01fc0 feat(crm): scaffold CRM service with full CRUD modules
Eigenstaendiger NestJS-Service unter packages/crm-service/ mit:
- Prisma Schema (app_crm): Contact, Activity, Pipeline, PipelineStage, Deal
- JWT RS256 Auth mit shared Public Key und Token-Revocation
- Multi-Tenancy: TenantGuard + tenantId-Filter auf allen Queries
- CRUD-Module: Contacts, Activities, Pipelines, Deals
- Docker-Integration: docker-compose.crm.yml (Port 3100, Traefik-Route /api/v1/crm)
- Health-Check, Swagger, GlobalExceptionFilter, Pagination

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 15:54:13 +01:00