Verkuerze die Inhaltsliste und fuehre Unterkapitel ein, damit Richtung, Bezuge und Struktur ohne Zusatzzeilen bedienbar bleiben.
Deploy Development / deploy (push) Successful in 29s
Test Suite / pytest-backend (push) Successful in 1m24s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 9s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-17 21:13:21 +02:00
1 parent eeeb81148a
commit e4380261fc
30 files changed
+2384 -430

No files matched your search

+94 -4
View File
@@ -44,6 +44,8 @@ from app.api.schemas import (
CasePatch,
ChapterDateIn,
ChapterDeleteIn,
ChapterParentIn,
BindingChaptersIn,
ChapterTitleIn,
CommunicationIn,
MatterMoveIn,
@@ -126,6 +128,8 @@ from app.ops import (
patch_task,
revoke_grant,
move_binding_chapter,
move_bindings_chapter,
move_chapter_parent,
move_matter,
reorder_bindings,
rename_chapter,
@@ -174,6 +178,16 @@ def _ctx_model(value) -> Ctx | None:
return None if value is None else Ctx(value.kind, value.id)
def _chapter_payload(row) -> dict:
return {
"id": str(row["id"]),
"title": row["title"],
"position": row["position"],
"document_on": dump_date(row["document_on"]),
"parent_chapter_id": str(row["parent_chapter_id"]) if row["parent_chapter_id"] else None,
}
def _session_body(conn, account_id: UUID, scope_kind: str, scope_id: UUID, csrf: str, epoch: int) -> dict:
account = conn.execute(
"SELECT id, email, display_name, is_superadmin FROM auth_accounts WHERE id = %s",
@@ -588,10 +602,20 @@ def post_case_chapter(
principal: Principal = Depends(get_principal),
conn: Connection = Depends(get_conn),
):
row = create_chapter(conn, principal.account_id, "case", case_id, body.title, body.position, None, body.document_on)
row = create_chapter(
conn,
principal.account_id,
"case",
case_id,
body.title,
body.position,
None,
body.document_on,
body.parent_chapter_id,
)
return _created(
f"/api/v1/cases/{case_id}/chapters/{row['id']}",
{"id": str(row["id"]), "title": row["title"], "position": row["position"], "document_on": dump_date(row["document_on"])},
_chapter_payload(row),
)
@@ -678,11 +702,19 @@ def post_matter_chapter(
):
context = parse_query_context(context_kind, context_id)
row = create_chapter(
conn, principal.account_id, "matter", matter_id, body.title, body.position, context, body.document_on
conn,
principal.account_id,
"matter",
matter_id,
body.title,
body.position,
context,
body.document_on,
body.parent_chapter_id,
)
return _created(
f"/api/v1/matters/{matter_id}/chapters/{row['id']}",
{"id": str(row["id"]), "title": row["title"], "position": row["position"], "document_on": dump_date(row["document_on"])},
_chapter_payload(row),
)
@@ -725,6 +757,24 @@ def post_delete_chapter(
return {"version": version}
@router.post("/api/v1/chapters/{chapter_id}/parent")
def post_chapter_parent(
chapter_id: UUID,
body: ChapterParentIn,
principal: Principal = Depends(get_principal),
conn: Connection = Depends(get_conn),
):
version = move_chapter_parent(
conn,
principal.account_id,
chapter_id,
body.expected_version,
body.parent_chapter_id,
_ctx_model(body.context),
)
return {"version": version, "parent_chapter_id": str(body.parent_chapter_id) if body.parent_chapter_id else None}
@router.post("/api/v1/cases/{case_id}/delete")
def post_delete_case(
case_id: UUID,
@@ -1426,6 +1476,26 @@ def post_case_binding_order(
return {"version": version}
@router.post("/api/v1/cases/{case_id}/bindings/chapters")
def post_case_binding_chapters(
case_id: UUID,
body: BindingChaptersIn,
principal: Principal = Depends(get_principal),
conn: Connection = Depends(get_conn),
):
version = move_bindings_chapter(
conn,
principal.account_id,
"case",
case_id,
body.expected_version,
body.binding_ids,
body.chapter_id,
None,
)
return {"version": version}
@router.patch("/api/v1/matters/{matter_id}/content-order")
def patch_matter_order(
matter_id: UUID,
@@ -1465,6 +1535,26 @@ def post_matter_binding_order(
return {"version": version}
@router.post("/api/v1/matters/{matter_id}/bindings/chapters")
def post_matter_binding_chapters(
matter_id: UUID,
body: BindingChaptersIn,
principal: Principal = Depends(get_principal),
conn: Connection = Depends(get_conn),
):
version = move_bindings_chapter(
conn,
principal.account_id,
"matter",
matter_id,
body.expected_version,
body.binding_ids,
body.chapter_id,
_ctx_model(body.context),
)
return {"version": version}
@router.patch("/api/v1/elements/{element_id}/dates")
def patch_element_dates(
element_id: UUID,