Nimm die Datenraum-Auswahl aus der Navigation.
Deploy Development / deploy (push) Successful in 22s

Die Sichtbarkeit wird an der Akte gewaehlt, auf der Kachel markiert und in der Liste gefiltert.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-16 22:33:34 +02:00
1 parent b03f571cd8
commit 0108a296bc
7 files changed
+62 -47

No files matched your search

+30 -3
View File
@@ -15,6 +15,7 @@ from app.access.policy import (
case_rights,
deadline_rights,
element_rights,
ensure_member_or_personal,
get_case,
get_deadline,
get_element,
@@ -22,6 +23,7 @@ from app.access.policy import (
get_task,
list_cases,
list_matters,
room_name,
matter_rights,
parse_context,
parse_query_context,
@@ -119,6 +121,15 @@ router = APIRouter()
_login_attempts: dict[str, list[datetime]] = {}
def _chosen_home(conn, principal: Principal, requested: UUID | None) -> UUID:
scope_id = requested or principal.scope_id
room = conn.execute("SELECT id, kind FROM data_rooms WHERE id = %s", (scope_id,)).fetchone()
if room is None:
raise not_found()
ensure_member_or_personal(conn, principal.account_id, room["kind"], room["id"])
return room["id"]
def _created(path: str, payload: dict) -> JSONResponse:
return JSONResponse(status_code=201, content=payload, headers={"Location": path})
@@ -412,13 +423,24 @@ 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 = [case_summary(case, rights) for case, rights in list_cases(conn, principal.account_id)]
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"])
items.append(summary)
return {"items": items, "next_cursor": None}
@router.post("/api/v1/cases")
def post_case(body: CaseIn, principal: Principal = Depends(get_principal), conn: Connection = Depends(get_conn)):
case = create_case(conn, principal.account_id, principal.scope_id, body.title, body.parent_case_id, body.rights_mode)
case = create_case(
conn,
principal.account_id,
_chosen_home(conn, principal, body.home_scope_id),
body.title,
body.parent_case_id,
body.rights_mode,
)
rights = case_rights(conn, principal.account_id, case)
return _created(f"/api/v1/cases/{case['id']}", case_summary(case, rights))
@@ -477,7 +499,12 @@ def matters(principal: Principal = Depends(get_principal), conn: Connection = De
@router.post("/api/v1/matters")
def post_matter(body: MatterIn, principal: Principal = Depends(get_principal), conn: Connection = Depends(get_conn)):
matter = create_matter(
conn, principal.account_id, principal.scope_id, body.title, body.parent_matter_id, _ctx_model(body.context)
conn,
principal.account_id,
_chosen_home(conn, principal, body.home_scope_id),
body.title,
body.parent_matter_id,
_ctx_model(body.context),
)
return _created(f"/api/v1/matters/{matter['id']}", matter_summary(conn, principal.account_id, matter))
+2
View File
@@ -54,6 +54,7 @@ class CaseIn(APIModel):
title: str = Field(min_length=1, max_length=200)
parent_case_id: UUID | None = None
rights_mode: Literal["inherit_parent", "explicit"] = "inherit_parent"
home_scope_id: UUID | None = None
class CasePatch(APIModel):
@@ -71,6 +72,7 @@ class MatterIn(APIModel):
title: str = Field(min_length=1, max_length=200)
parent_matter_id: UUID | None = None
context: ContextIn | None = None
home_scope_id: UUID | None = None
class MatterPatch(APIModel):