Halte die Vorgangsleiste sichtbar und nimm die ueberfluessigen Kapitelworte weg, damit Datum, Bezuege, Titel und mehrere Belege direkt gesetzt werden koennen.
Deploy Development / deploy (push) Successful in 30s
Test Suite / pytest-backend (push) Successful in 1m28s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 8s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-17 22:46:12 +02:00
1 parent cbd45a8997
commit deb5d662fe
13 files changed
+423 -101

No files matched your search

+20
View File
@@ -78,6 +78,7 @@ from app.api.schemas import (
TaskDependencyIn,
TaskElementsIn,
SummaryPatch,
TitlePatch,
TaskIn,
TaskPatch,
)
@@ -142,6 +143,7 @@ from app.ops import (
update_dates,
update_note,
update_summary,
update_title,
)
from app.present import (
LABELS,
@@ -1593,6 +1595,24 @@ def patch_element_summary(
return {"id": str(element["id"]), "version": element["version"], "summary": element["summary"]}
@router.patch("/api/v1/elements/{element_id}/title")
def patch_element_title(
element_id: UUID,
body: TitlePatch,
principal: Principal = Depends(get_principal),
conn: Connection = Depends(get_conn),
):
element = update_title(
conn,
principal.account_id,
element_id,
body.expected_version,
body.title,
_ctx_model(body.context),
)
return {"id": str(element["id"]), "version": element["version"], "title": element["title"]}
@router.patch("/api/v1/bindings/{binding_id}/chapter")
def patch_binding_chapter(
binding_id: UUID,
+6
View File
@@ -220,6 +220,12 @@ class SummaryPatch(APIModel):
context: ContextIn | None = None
class TitlePatch(APIModel):
expected_version: int = Field(ge=1)
title: str = Field(min_length=1, max_length=200)
context: ContextIn | None = None
class ChapterMoveIn(APIModel):
expected_version: int = Field(ge=1)
chapter_id: UUID | None = None
+13
View File
@@ -1497,6 +1497,19 @@ def update_summary(conn, actor: UUID, element_id: UUID, expected: int, summary:
return get_element(conn, element_id)
def update_title(conn, actor: UUID, element_id: UUID, expected: int, title: str, context: Ctx | None) -> dict:
element, rights = require_element(conn, actor, element_id, context, "edit")
if not rights.edit:
raise forbidden()
cleaned = title.strip()
if not cleaned or len(cleaned) > 200:
raise unprocessable("Der Titel fehlt oder ist zu lang.")
bump_version(conn, "elements", element_id, expected)
conn.execute("UPDATE elements SET title = %s WHERE id = %s", (cleaned, element_id))
audit(conn, actor, element["home_scope_id"], "title_changed", "element", element_id, context)
return get_element(conn, element_id)
def move_binding_chapter(conn, actor: UUID, binding_id: UUID, expected: int, chapter_id: UUID | None, context: Ctx | None) -> int:
"""Move one visible binding inside its container. No new binding and no grant."""
binding = conn.execute("SELECT * FROM bindings WHERE id = %s", (binding_id,)).fetchone()
+1
View File
@@ -954,6 +954,7 @@ LABELS = {
"correspondence_recorded": "Erfassung",
"chapter_created": "Kapitel angelegt",
"summary_changed": "Kurzbeschreibung geändert",
"title_changed": "Titel geändert",
"binding_chapter": "In ein Kapitel eingeordnet",
"chapters_reordered": "Kapitelreihenfolge geändert",
"chapter_dated": "Kapiteldatum geändert",
+47
View File
@@ -0,0 +1,47 @@
"""An entry title can be renamed without touching the document body."""
from __future__ import annotations
from tests.support import Actor, document, register
def test_element_title_can_be_renamed(client, db):
ada = Actor(client, "ada-titel@example.test", "Ada Titel")
register(db, ada.email, ada.name)
ada.login()
matter = ada.request("POST", "/api/v1/matters", json={"title": "Vorgang"}, status=201)
ada.request(
"POST",
"/api/v1/notes",
json={
"title": "Alter Titel",
"document": document("Text"),
"context": {"kind": "matter", "id": matter["id"]},
},
status=201,
)
detail = ada.request("GET", f"/api/v1/matters/{matter['id']}")
element = detail["bindings"][0]["element"]
renamed = ada.request(
"PATCH",
f"/api/v1/elements/{element['id']}/title",
json={
"expected_version": element["version"],
"title": "Neuer Titel",
"context": {"kind": "matter", "id": matter["id"]},
},
)
assert renamed["title"] == "Neuer Titel"
assert renamed["version"] == element["version"] + 1
shown = ada.request("GET", f"/api/v1/matters/{matter['id']}")
assert shown["bindings"][0]["element"]["title"] == "Neuer Titel"
ada.request(
"PATCH",
f"/api/v1/elements/{element['id']}/title",
json={
"expected_version": renamed["version"],
"title": " ",
"context": {"kind": "matter", "id": matter["id"]},
},
status=422,
)