refactor(consent-sdk,dsms-gateway): split ConsentManager, types, and main.py
- consent-sdk/src/types/index.ts: extracted 438 LOC into core.ts, config.ts, vendor.ts, api.ts, events.ts, storage.ts, translations.ts; index.ts is now a 21-LOC barrel re-exporter - consent-sdk/src/core/ConsentManager.ts: extracted normalizeConsentInput, isConsentExpired, needsConsent, ALL_CATEGORIES, MINIMAL_CATEGORIES into consent-manager-helpers.ts; reduced from 467 to 345 LOC - dsms-gateway/main.py: extracted models → models.py, config → config.py, IPFS helpers + verify_token → dependencies.py, route handlers → routers/documents.py and routers/node.py; main.py is now a 41-LOC app factory; test mock paths updated accordingly (27/27 tests pass) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
32
dsms-gateway/models.py
Normal file
32
dsms-gateway/models.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""
|
||||
DSMS Gateway — Pydantic request/response models.
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class DocumentMetadata(BaseModel):
|
||||
"""Metadaten für gespeicherte Dokumente"""
|
||||
document_type: str # 'legal_document', 'consent_record', 'audit_log'
|
||||
document_id: Optional[str] = None
|
||||
version: Optional[str] = None
|
||||
language: Optional[str] = "de"
|
||||
created_at: Optional[str] = None
|
||||
checksum: Optional[str] = None
|
||||
encrypted: bool = False
|
||||
|
||||
|
||||
class StoredDocument(BaseModel):
|
||||
"""Antwort nach erfolgreichem Speichern"""
|
||||
cid: str # Content Identifier (IPFS Hash)
|
||||
size: int
|
||||
metadata: DocumentMetadata
|
||||
gateway_url: str
|
||||
timestamp: str
|
||||
|
||||
|
||||
class DocumentList(BaseModel):
|
||||
"""Liste der gespeicherten Dokumente"""
|
||||
documents: list
|
||||
total: int
|
||||
Reference in New Issue
Block a user