Dokumente generieren
Basierend auf Ihrem Profil können DSFA, VVT, TOM, Löschfristen und Pflichten automatisch als Entwürfe generiert werden.
diff --git a/admin-compliance/lib/sdk/types.ts b/admin-compliance/lib/sdk/types.ts
index b91273f..0e26140 100644
--- a/admin-compliance/lib/sdk/types.ts
+++ b/admin-compliance/lib/sdk/types.ts
@@ -201,11 +201,11 @@ export const COMPANY_SIZE_LABELS: Record = {
enterprise: 'Konzern (1000+ MA)',
}
-export const BUSINESS_MODEL_LABELS: Record = {
- B2B: 'B2B (Geschäftskunden)',
- B2C: 'B2C (Privatkunden)',
- B2B_B2C: 'B2B und B2C',
- B2B2C: 'B2B2C (über Partner an Endkunden)',
+export const BUSINESS_MODEL_LABELS: Record = {
+ B2B: { short: 'B2B', description: 'Verkauf an Geschäftskunden' },
+ B2C: { short: 'B2C', description: 'Verkauf an Privatkunden' },
+ B2B_B2C: { short: 'B2B + B2C', description: 'Verkauf an Geschäfts- und Privatkunden' },
+ B2B2C: { short: 'B2B2C', description: 'Über Partner an Endkunden (z.B. Plattform, White-Label)' },
}
export const OFFERING_TYPE_LABELS: Record = {
diff --git a/backend-compliance/compliance/api/company_profile_routes.py b/backend-compliance/compliance/api/company_profile_routes.py
index 0b44a86..d8c2740 100644
--- a/backend-compliance/compliance/api/company_profile_routes.py
+++ b/backend-compliance/compliance/api/company_profile_routes.py
@@ -15,6 +15,7 @@ from typing import Optional
from fastapi import APIRouter, HTTPException, Header
from pydantic import BaseModel
+from sqlalchemy import text
from database import SessionLocal
@@ -224,9 +225,9 @@ def log_audit(db, tenant_id: str, action: str, changed_fields: Optional[dict], c
"""Write an audit log entry."""
try:
db.execute(
- """INSERT INTO compliance_company_profile_audit
+ text("""INSERT INTO compliance_company_profile_audit
(tenant_id, action, changed_fields, changed_by)
- VALUES (:tenant_id, :action, :fields::jsonb, :changed_by)""",
+ VALUES (:tenant_id, :action, :fields::jsonb, :changed_by)"""),
{
"tenant_id": tenant_id,
"action": action,
@@ -252,7 +253,7 @@ async def get_company_profile(
db = SessionLocal()
try:
result = db.execute(
- f"SELECT {_BASE_COLUMNS} FROM compliance_company_profiles WHERE tenant_id = :tenant_id",
+ text(f"SELECT {_BASE_COLUMNS} FROM compliance_company_profiles WHERE tenant_id = :tenant_id"),
{"tenant_id": tid},
)
row = result.fetchone()
@@ -276,7 +277,7 @@ async def upsert_company_profile(
try:
# Check if profile exists
existing = db.execute(
- "SELECT id FROM compliance_company_profiles WHERE tenant_id = :tid",
+ text("SELECT id FROM compliance_company_profiles WHERE tenant_id = :tid"),
{"tid": tid},
).fetchone()
@@ -285,7 +286,7 @@ async def upsert_company_profile(
completed_at_clause = ", completed_at = NOW()" if profile.is_complete else ", completed_at = NULL"
db.execute(
- f"""INSERT INTO compliance_company_profiles
+ text(f"""INSERT INTO compliance_company_profiles
(tenant_id, company_name, legal_form, industry, founded_year,
business_model, offerings, company_size, employee_count, annual_revenue,
headquarters_country, headquarters_city, has_international_locations,
@@ -344,7 +345,7 @@ async def upsert_company_profile(
supervisory_authority = EXCLUDED.supervisory_authority,
review_cycle_months = EXCLUDED.review_cycle_months,
updated_at = NOW()
- {completed_at_clause}""",
+ {completed_at_clause}"""),
{
"tid": tid,
"company_name": profile.company_name,
@@ -392,7 +393,7 @@ async def upsert_company_profile(
# Fetch and return
result = db.execute(
- f"SELECT {_BASE_COLUMNS} FROM compliance_company_profiles WHERE tenant_id = :tid",
+ text(f"SELECT {_BASE_COLUMNS} FROM compliance_company_profiles WHERE tenant_id = :tid"),
{"tid": tid},
)
row = result.fetchone()
@@ -415,7 +416,7 @@ async def delete_company_profile(
db = SessionLocal()
try:
existing = db.execute(
- "SELECT id FROM compliance_company_profiles WHERE tenant_id = :tid",
+ text("SELECT id FROM compliance_company_profiles WHERE tenant_id = :tid"),
{"tid": tid},
).fetchone()
@@ -423,7 +424,7 @@ async def delete_company_profile(
raise HTTPException(status_code=404, detail="Company profile not found")
db.execute(
- "DELETE FROM compliance_company_profiles WHERE tenant_id = :tid",
+ text("DELETE FROM compliance_company_profiles WHERE tenant_id = :tid"),
{"tid": tid},
)
@@ -451,7 +452,7 @@ async def get_template_context(
db = SessionLocal()
try:
result = db.execute(
- f"SELECT {_BASE_COLUMNS} FROM compliance_company_profiles WHERE tenant_id = :tid",
+ text(f"SELECT {_BASE_COLUMNS} FROM compliance_company_profiles WHERE tenant_id = :tid"),
{"tid": tid},
)
row = result.fetchone()
@@ -513,11 +514,11 @@ async def get_audit_log(
db = SessionLocal()
try:
result = db.execute(
- """SELECT id, action, changed_fields, changed_by, created_at
+ text("""SELECT id, action, changed_fields, changed_by, created_at
FROM compliance_company_profile_audit
WHERE tenant_id = :tid
ORDER BY created_at DESC
- LIMIT 100""",
+ LIMIT 100"""),
{"tid": tid},
)
rows = result.fetchall()
diff --git a/backend-compliance/compliance/api/generation_routes.py b/backend-compliance/compliance/api/generation_routes.py
index cce3719..ce8f452 100644
--- a/backend-compliance/compliance/api/generation_routes.py
+++ b/backend-compliance/compliance/api/generation_routes.py
@@ -39,7 +39,7 @@ def _get_template_context(db, tid: str) -> dict:
cp_db = SessionLocal()
try:
result = cp_db.execute(
- f"SELECT {_BASE_COLUMNS} FROM compliance_company_profiles WHERE tenant_id = :tid",
+ text(f"SELECT {_BASE_COLUMNS} FROM compliance_company_profiles WHERE tenant_id = :tid"),
{"tid": tid},
)
row = result.fetchone()