Liefere Zähler, Rauminhalt und Teilen im Stapel für die neue Ablage.
Akten und Vorgänge melden Unterakten, Vorgänge und die Räume, mit denen sie geteilt sind, jeweils nur aus Lesbarem. Neue Endpunkte zeigen die Räume als Kacheln, den Inhalt eines Raums und teilen mehrere Einträge auf einmal oder gar nicht. Beim Anlegen lässt sich ein Eintrag gleich in einen Raum legen. Die lokale Suite läuft mit 148 Tests grün. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
30b6544514
commit
d39c7d7999
9 files changed
+411
-24
No files matched your search
@@ -165,9 +165,10 @@ from app.present import (
|
||||
matter_detail,
|
||||
matter_summary,
|
||||
note_update_payload,
|
||||
shared_room_names,
|
||||
task_payload,
|
||||
)
|
||||
from app.library import case_items, matter_items
|
||||
from app.ops import share_with_room as _share_with_room
|
||||
from app.seed import demo_public
|
||||
|
||||
router = APIRouter()
|
||||
@@ -382,20 +383,7 @@ def find_principal(email: str, principal: Principal = Depends(get_principal), co
|
||||
|
||||
@router.get("/api/v1/cases")
|
||||
def cases(principal: Principal = Depends(get_principal), conn: Connection = Depends(get_conn)):
|
||||
items = []
|
||||
for case, rights in list_cases(conn, principal.account_id):
|
||||
summary = case_summary(case, rights)
|
||||
summary["home_scope_name"] = room_name(conn, case["home_scope_id"])
|
||||
summary["kind_label"] = "Unterakte" if case["parent_case_id"] else "Akte"
|
||||
summary["parent_title"] = None
|
||||
summary["is_owner"] = case["owner_subject_id"] == principal.account_id
|
||||
summary["shared_with"] = shared_room_names(conn, "case", case["id"]) if summary["is_owner"] else []
|
||||
if case["parent_case_id"]:
|
||||
parent = get_case(conn, case["parent_case_id"])
|
||||
if parent is not None and case_rights(conn, principal.account_id, parent).read:
|
||||
summary["parent_title"] = parent["title"]
|
||||
items.append(summary)
|
||||
return {"items": items, "next_cursor": None}
|
||||
return {"items": case_items(conn, principal.account_id, list_cases(conn, principal.account_id)), "next_cursor": None}
|
||||
|
||||
|
||||
@router.post("/api/v1/cases")
|
||||
@@ -408,6 +396,8 @@ def post_case(body: CaseIn, principal: Principal = Depends(get_principal), conn:
|
||||
body.parent_case_id,
|
||||
body.rights_mode,
|
||||
)
|
||||
if body.share_with_room_id is not None:
|
||||
_share_with_room(conn, principal.account_id, "case", case["id"], body.share_with_room_id, "edit")
|
||||
rights = case_rights(conn, principal.account_id, case)
|
||||
return _created(f"/api/v1/cases/{case['id']}", case_summary(case, rights))
|
||||
|
||||
@@ -492,8 +482,7 @@ def post_case_grant(
|
||||
|
||||
@router.get("/api/v1/matters")
|
||||
def matters(principal: Principal = Depends(get_principal), conn: Connection = Depends(get_conn)):
|
||||
items = [matter_summary(conn, principal.account_id, matter) for matter, _contexts in list_matters(conn, principal.account_id)]
|
||||
return {"items": items, "next_cursor": None}
|
||||
return {"items": matter_items(conn, principal.account_id, list_matters(conn, principal.account_id)), "next_cursor": None}
|
||||
|
||||
|
||||
@router.post("/api/v1/matters")
|
||||
@@ -506,6 +495,8 @@ def post_matter(body: MatterIn, principal: Principal = Depends(get_principal), c
|
||||
body.parent_matter_id,
|
||||
_ctx_model(body.context),
|
||||
)
|
||||
if body.share_with_room_id is not None:
|
||||
_share_with_room(conn, principal.account_id, "matter", matter["id"], body.share_with_room_id, "edit")
|
||||
return _created(f"/api/v1/matters/{matter['id']}", matter_summary(conn, principal.account_id, matter))
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user