feat: 6 Dokumentations-Module auf 100% — VVT Backend, Filter, PDF-Export
Phase 1 — VVT Backend (localStorage → API): - migrations/006_vvt.sql: Neue Tabellen (vvt_organization, vvt_activities, vvt_audit_log) - compliance/db/vvt_models.py: SQLAlchemy-Models für alle VVT-Tabellen - compliance/api/vvt_routes.py: Vollständiger CRUD-Router (10 Endpoints) - compliance/api/__init__.py: VVT-Router registriert - compliance/api/schemas.py: VVT Pydantic-Schemas ergänzt - app/(sdk)/sdk/vvt/page.tsx: API-Client + camelCase↔snake_case Mapping, localStorage durch persistente DB-Calls ersetzt (POST/PUT/DELETE/GET) - tests/test_vvt_routes.py: 18 Tests (alle grün) Phase 3 — Document Generator PDF-Export: - document-generator/page.tsx: "Als PDF exportieren"-Button funktioniert jetzt via window.print() + Print-Window mit korrektem HTML - Fallback-Banner wenn Template-Service (breakpilot-core) nicht erreichbar Phase 4 — Source Policy erweiterte Filter: - SourcesTab.tsx: source_type-Filter (Rechtlich / Leitlinien / Vorlagen / etc.) - PIIRulesTab.tsx: category-Filter (E-Mail / Telefon / IBAN / etc.) - source_policy_router.py: Backend-Endpoints unterstützen jetzt source_type und category als Query-Parameter - requirements.txt: reportlab==4.2.5 ergänzt (fehlende Audit-PDF-Dependency) Phase 2 — Training (Migration-Skripte): - scripts/apply_training_migrations.sh: SSH-Skript für Mac Mini - scripts/apply_vvt_migration.sh: Vollständiges Deploy-Skript für VVT Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
38
scripts/apply_training_migrations.sh
Normal file
38
scripts/apply_training_migrations.sh
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
# Apply Training Engine migrations on Mac Mini and verify
|
||||
# Usage: bash scripts/apply_training_migrations.sh
|
||||
|
||||
set -e
|
||||
|
||||
DOCKER="/usr/local/bin/docker"
|
||||
CONTAINER="bp-compliance-ai-sdk"
|
||||
PROJECT_DIR="/Users/benjaminadmin/Projekte/breakpilot-compliance"
|
||||
|
||||
echo "==> Applying Training Engine migrations on Mac Mini..."
|
||||
|
||||
ssh macmini "cd ${PROJECT_DIR} && \
|
||||
${DOCKER} exec ${CONTAINER} \
|
||||
psql \"\${DATABASE_URL}\" -f /migrations/014_training_engine.sql \
|
||||
&& echo 'Migration 014 applied' \
|
||||
|| echo 'Migration 014 may already be applied (table exists)'"
|
||||
|
||||
ssh macmini "cd ${PROJECT_DIR} && \
|
||||
${DOCKER} exec ${CONTAINER} \
|
||||
psql \"\${DATABASE_URL}\" -f /migrations/016_training_media.sql \
|
||||
&& echo 'Migration 016 applied' \
|
||||
|| echo 'Migration 016 may already be applied'"
|
||||
|
||||
echo ""
|
||||
echo "==> Verifying training service..."
|
||||
curl -sf "https://macmini:8093/health" && echo "Health check: OK" || echo "Health check: FAILED"
|
||||
|
||||
echo ""
|
||||
echo "==> Checking training modules endpoint..."
|
||||
curl -sf \
|
||||
"https://macmini:8093/sdk/v1/training/modules" \
|
||||
-H "X-Tenant-ID: 9282a473-5c95-4b3a-bf78-0ecc0ec71d3e" \
|
||||
| python3 -c "import sys,json; d=json.load(sys.stdin); print(f'Modules found: {len(d.get(\"modules\",[]))}')" \
|
||||
|| echo "Training modules endpoint check failed"
|
||||
|
||||
echo ""
|
||||
echo "Done."
|
||||
55
scripts/apply_vvt_migration.sh
Normal file
55
scripts/apply_vvt_migration.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
# Apply VVT migration and rebuild backend-compliance on Mac Mini
|
||||
# Usage: bash scripts/apply_vvt_migration.sh
|
||||
|
||||
set -e
|
||||
|
||||
DOCKER="/usr/local/bin/docker"
|
||||
BACKEND_CONTAINER="bp-compliance-backend"
|
||||
PROJECT_DIR="/Users/benjaminadmin/Projekte/breakpilot-compliance"
|
||||
|
||||
echo "==> Pushing code to Mac Mini..."
|
||||
git push origin main && git push gitea main
|
||||
|
||||
echo "==> Pulling code on Mac Mini..."
|
||||
ssh macmini "cd ${PROJECT_DIR} && git pull --no-rebase origin main"
|
||||
|
||||
echo "==> Applying VVT migration (006_vvt.sql)..."
|
||||
ssh macmini "cd ${PROJECT_DIR} && \
|
||||
${DOCKER} exec ${BACKEND_CONTAINER} \
|
||||
python3 -c \"
|
||||
import psycopg2
|
||||
import os
|
||||
|
||||
conn = psycopg2.connect(os.environ['DATABASE_URL'])
|
||||
conn.autocommit = True
|
||||
cur = conn.cursor()
|
||||
with open('/app/migrations/006_vvt.sql', 'r') as f:
|
||||
sql = f.read()
|
||||
cur.execute(sql)
|
||||
cur.close()
|
||||
conn.close()
|
||||
print('VVT migration applied successfully')
|
||||
\"" || echo "Note: Migration may use different DB connection method. Trying psql..."
|
||||
|
||||
ssh macmini "cd ${PROJECT_DIR} && \
|
||||
${DOCKER} exec ${BACKEND_CONTAINER} \
|
||||
psql \"\${DATABASE_URL}\" -f /app/migrations/006_vvt.sql \
|
||||
&& echo 'VVT migration (psql) applied' \
|
||||
|| echo 'Could not apply via psql, check manually'"
|
||||
|
||||
echo ""
|
||||
echo "==> Rebuilding backend-compliance..."
|
||||
ssh macmini "cd ${PROJECT_DIR} && \
|
||||
${DOCKER} compose build --no-cache backend-compliance && \
|
||||
${DOCKER} compose up -d backend-compliance"
|
||||
|
||||
echo ""
|
||||
echo "==> Verifying VVT endpoint..."
|
||||
sleep 5
|
||||
curl -sf "https://macmini:8002/api/compliance/vvt/stats" \
|
||||
| python3 -c "import sys,json; d=json.load(sys.stdin); print(f'VVT stats: total={d.get(\"total\",0)}')" \
|
||||
|| echo "VVT endpoint check: needs backend restart"
|
||||
|
||||
echo ""
|
||||
echo "Done. Check logs: ssh macmini '${DOCKER} logs -f ${BACKEND_CONTAINER}'"
|
||||
Reference in New Issue
Block a user