feat: Package 4 Phase 2 — Frontend-Fixes und Backend-Endpoints vervollständigt
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 33s
CI / test-python-backend-compliance (push) Successful in 33s
CI / test-python-document-crawler (push) Successful in 21s
CI / test-python-dsms-gateway (push) Successful in 17s
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 33s
CI / test-python-backend-compliance (push) Successful in 33s
CI / test-python-document-crawler (push) Successful in 21s
CI / test-python-dsms-gateway (push) Successful in 17s
- document-generator: STEP_EXPLANATIONS Key 'consent' → 'document-generator'
- Proxy: Content-Type nicht mehr hardcoded; forwarded vom Client (Fix für DOCX-Upload + multipart/arrayBuffer)
- Backend: GET /documents/{id}, DELETE /documents/{id}, GET /versions/{id} ergänzt
- Backend-Tests: 4 neue Tests für die neuen Endpoints
- consent/page.tsx: Create-Modal + handleCreateDocument() + DELETE-Handler verdrahtet
- einwilligungen/page.tsx: odentifier→identifier, ip_address, user_agent, history aus API gemappt; source nullable
- cookie-banner/page.tsx: handleExportCode() + Toast für 'Code exportieren' Button
- workflow/page.tsx: 'Neues Dokument' Button + createDocument() + Modal
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -199,6 +199,25 @@ async def create_document(
|
||||
return _doc_to_response(doc)
|
||||
|
||||
|
||||
@router.get("/documents/{document_id}", response_model=DocumentResponse)
|
||||
async def get_document(document_id: str, db: Session = Depends(get_db)):
|
||||
"""Get a single legal document by ID."""
|
||||
doc = db.query(LegalDocumentDB).filter(LegalDocumentDB.id == document_id).first()
|
||||
if not doc:
|
||||
raise HTTPException(status_code=404, detail=f"Document {document_id} not found")
|
||||
return _doc_to_response(doc)
|
||||
|
||||
|
||||
@router.delete("/documents/{document_id}", status_code=204)
|
||||
async def delete_document(document_id: str, db: Session = Depends(get_db)):
|
||||
"""Delete a legal document and all its versions."""
|
||||
doc = db.query(LegalDocumentDB).filter(LegalDocumentDB.id == document_id).first()
|
||||
if not doc:
|
||||
raise HTTPException(status_code=404, detail=f"Document {document_id} not found")
|
||||
db.delete(doc)
|
||||
db.commit()
|
||||
|
||||
|
||||
@router.get("/documents/{document_id}/versions", response_model=List[VersionResponse])
|
||||
async def list_versions(document_id: str, db: Session = Depends(get_db)):
|
||||
"""List all versions for a legal document."""
|
||||
@@ -271,6 +290,15 @@ async def update_version(
|
||||
return _version_to_response(version)
|
||||
|
||||
|
||||
@router.get("/versions/{version_id}", response_model=VersionResponse)
|
||||
async def get_version(version_id: str, db: Session = Depends(get_db)):
|
||||
"""Get a single version by ID."""
|
||||
v = db.query(LegalDocumentVersionDB).filter(LegalDocumentVersionDB.id == version_id).first()
|
||||
if not v:
|
||||
raise HTTPException(status_code=404, detail=f"Version {version_id} not found")
|
||||
return _version_to_response(v)
|
||||
|
||||
|
||||
@router.post("/versions/upload-word", response_model=Dict[str, Any])
|
||||
async def upload_word(file: UploadFile = File(...)):
|
||||
"""Convert DOCX to HTML using mammoth (if available) or return raw text."""
|
||||
|
||||
Reference in New Issue
Block a user