All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 32s
CI / test-python-backend-compliance (push) Successful in 30s
CI / test-python-document-crawler (push) Successful in 21s
CI / test-python-dsms-gateway (push) Successful in 18s
6-Phasen-Implementation fuer cloud-faehiges, mandantenfaehiges Compliance SDK:
Phase 1: Multi-Tenancy Fix
- Shared tenant_utils.py Dependency (UUID-Validierung, kein "default" mehr)
- VVT tenant_id Column + tenant-scoped Queries
- DSFA/Vendor DEFAULT_TENANT_ID von "default" auf UUID migriert
- Migration 035
Phase 2: Stammdaten-Erweiterung
- Company Profile um JSONB-Felder erweitert (processing_systems, ai_systems, technical_contacts)
- Regulierungs-Flags (NIS2, AI Act, ISO 27001)
- GET /template-context Endpoint
- Migration 036
Phase 3: Dokument-Versionierung
- 5 Versions-Tabellen (DSFA, VVT, TOM, Loeschfristen, Obligations)
- Shared versioning_utils.py Helper
- /{id}/versions Endpoints auf allen 5 Dokumenttypen
- Migration 037
Phase 4: Change-Request System
- Zentrale CR-Inbox mit CRUD + Accept/Reject/Edit Workflow
- Regelbasierte CR-Engine (VVT DPIA → DSFA CR, Datenkategorien → Loeschfristen CR)
- Audit-Trail
- Migration 038
Phase 5: Dokumentengenerierung
- 5 Template-Generatoren (DSFA, VVT, TOM, Loeschfristen, Obligations)
- Preview + Apply Endpoints (erzeugt CRs, keine direkten Dokumente)
Phase 6: Frontend-Integration
- Change-Request Inbox Page mit Stats, Filtern, Modals
- VersionHistory Timeline-Komponente
- SDKSidebar CR-Badge (60s Polling)
- Company Profile: 2 neue Wizard-Steps + "Dokumente generieren" CTA
Docs: 5 neue MkDocs-Seiten, CLAUDE.md aktualisiert
Tests: 97 neue Tests (alle bestanden)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
117 lines
4.4 KiB
Python
117 lines
4.4 KiB
Python
"""
|
|
SQLAlchemy models for VVT — Verzeichnis von Verarbeitungstaetigkeiten (Art. 30 DSGVO).
|
|
|
|
Tables:
|
|
- compliance_vvt_organization: Organization header (DSB, version, review dates)
|
|
- compliance_vvt_activities: Individual processing activities
|
|
- compliance_vvt_audit_log: Audit trail for all VVT changes
|
|
"""
|
|
|
|
import uuid
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import (
|
|
Column, String, Text, Boolean, Integer, Date, DateTime, JSON, Index
|
|
)
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
|
|
from classroom_engine.database import Base
|
|
|
|
|
|
class VVTOrganizationDB(Base):
|
|
"""VVT organization header — stores DSB contact, version and review schedule."""
|
|
|
|
__tablename__ = 'compliance_vvt_organization'
|
|
|
|
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
|
tenant_id = Column(String(255), nullable=False, index=True)
|
|
organization_name = Column(String(300), nullable=False)
|
|
industry = Column(String(100))
|
|
locations = Column(JSON, default=list)
|
|
employee_count = Column(Integer)
|
|
dpo_name = Column(String(200))
|
|
dpo_contact = Column(String(200))
|
|
vvt_version = Column(String(20), default='1.0')
|
|
last_review_date = Column(Date)
|
|
next_review_date = Column(Date)
|
|
review_interval = Column(String(20), default='annual')
|
|
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
__table_args__ = (
|
|
Index('idx_vvt_org_created', 'created_at'),
|
|
)
|
|
|
|
def __repr__(self):
|
|
return f"<VVTOrganization {self.organization_name}>"
|
|
|
|
|
|
class VVTActivityDB(Base):
|
|
"""Individual processing activity per Art. 30 DSGVO."""
|
|
|
|
__tablename__ = 'compliance_vvt_activities'
|
|
|
|
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
|
tenant_id = Column(String(255), nullable=False, index=True)
|
|
vvt_id = Column(String(50), nullable=False)
|
|
name = Column(String(300), nullable=False)
|
|
description = Column(Text)
|
|
purposes = Column(JSON, default=list)
|
|
legal_bases = Column(JSON, default=list)
|
|
data_subject_categories = Column(JSON, default=list)
|
|
personal_data_categories = Column(JSON, default=list)
|
|
recipient_categories = Column(JSON, default=list)
|
|
third_country_transfers = Column(JSON, default=list)
|
|
retention_period = Column(JSON, default=dict)
|
|
tom_description = Column(Text)
|
|
business_function = Column(String(50))
|
|
systems = Column(JSON, default=list)
|
|
deployment_model = Column(String(20))
|
|
data_sources = Column(JSON, default=list)
|
|
data_flows = Column(JSON, default=list)
|
|
protection_level = Column(String(10), default='MEDIUM')
|
|
dpia_required = Column(Boolean, default=False)
|
|
structured_toms = Column(JSON, default=dict)
|
|
status = Column(String(20), default='DRAFT')
|
|
responsible = Column(String(200))
|
|
owner = Column(String(200))
|
|
last_reviewed_at = Column(DateTime(timezone=True), nullable=True)
|
|
next_review_at = Column(DateTime(timezone=True), nullable=True)
|
|
created_by = Column(String(200), default='system')
|
|
dsfa_id = Column(UUID(as_uuid=True), nullable=True)
|
|
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
__table_args__ = (
|
|
Index('idx_vvt_activities_status', 'status'),
|
|
Index('idx_vvt_activities_business_function', 'business_function'),
|
|
Index('idx_vvt_activities_tenant_status', 'tenant_id', 'status'),
|
|
)
|
|
|
|
def __repr__(self):
|
|
return f"<VVTActivity {self.vvt_id}: {self.name}>"
|
|
|
|
|
|
class VVTAuditLogDB(Base):
|
|
"""Audit trail for all VVT create/update/delete/export actions."""
|
|
|
|
__tablename__ = 'compliance_vvt_audit_log'
|
|
|
|
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
|
tenant_id = Column(String(255), nullable=False, index=True)
|
|
action = Column(String(20), nullable=False) # CREATE, UPDATE, DELETE, EXPORT
|
|
entity_type = Column(String(50), nullable=False) # activity, organization
|
|
entity_id = Column(UUID(as_uuid=True))
|
|
changed_by = Column(String(200))
|
|
old_values = Column(JSON)
|
|
new_values = Column(JSON)
|
|
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
|
|
|
__table_args__ = (
|
|
Index('idx_vvt_audit_created', 'created_at'),
|
|
Index('idx_vvt_audit_entity', 'entity_type', 'entity_id'),
|
|
)
|
|
|
|
def __repr__(self):
|
|
return f"<VVTAuditLog {self.action} {self.entity_type}>"
|