Zeige den Bezug zwischen Schreiben und lies eine E-Mail vor dem Uebernehmen.
Deploy Development / deploy (push) Successful in 27s
Test Suite / pytest-backend (push) Successful in 1m10s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 8s

Die Liste behaelt die Schreiben dazwischen. Richtung, Absender, Empfaenger und Anhaenge bleiben an der Nachricht erkennbar.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-17 17:27:17 +02:00
1 parent 97bffc6175
commit f27df3ff35
19 files changed
+1049 -49

No files matched your search

+60 -2
View File
@@ -529,6 +529,8 @@ def create_note(
placement: Ctx | None,
chapter_id: UUID | None,
document_on: date | None = None,
sent_on: date | None = None,
received_on: date | None = None,
) -> dict:
document = clean_document(document)
target, rights_context = _placement(context, placement)
@@ -540,8 +542,8 @@ def create_note(
)
binding = insert_binding(conn, element["id"], target.kind, target.id, chapter_id, actor)
audit(conn, actor, scope_id, "note_created", "element", element["id"], rights_context or target)
if document_on is not None:
record_dates(conn, actor, scope_id, element["id"], rights_context or target, document_on, None, None)
if document_on is not None or sent_on is not None or received_on is not None:
record_dates(conn, actor, scope_id, element["id"], rights_context or target, document_on, sent_on, received_on)
return {"element": element, "binding": binding, "document": document}
@@ -962,6 +964,62 @@ def unlink_task_dependency(conn, actor: UUID, task_id: UUID, depends_on_task_id:
)
def _reference_chain(conn, start: UUID) -> set[UUID]:
seen: set[UUID] = set()
stack = [start]
while stack:
current = stack.pop()
if current in seen:
continue
seen.add(current)
rows = conn.execute(
"SELECT refers_to_element_id FROM element_references WHERE element_id = %s",
(current,),
).fetchall()
stack.extend(row["refers_to_element_id"] for row in rows)
return seen
def link_element_reference(conn, actor: UUID, element_id: UUID, refers_to_element_id: UUID, context: Ctx | None) -> None:
if element_id == refers_to_element_id:
raise unprocessable("Eine Unterlage kann nicht auf sich selbst Bezug nehmen.")
element = get_element(conn, element_id)
target = get_element(conn, refers_to_element_id)
if element is None or target is None:
raise not_found()
rights = element_rights(conn, actor, element, context)
target_rights = element_rights(conn, actor, target, context)
if not rights.read or not target_rights.read:
raise not_found()
if not rights.edit:
raise forbidden()
if element_id in _reference_chain(conn, refers_to_element_id):
raise unprocessable("Dieser Bezug würde einen Kreis bilden.")
conn.execute(
"""
INSERT INTO element_references (element_id, refers_to_element_id)
VALUES (%s, %s)
ON CONFLICT DO NOTHING
""",
(element_id, refers_to_element_id),
)
def unlink_element_reference(conn, actor: UUID, element_id: UUID, refers_to_element_id: UUID, context: Ctx | None) -> None:
element = get_element(conn, element_id)
if element is None:
raise not_found()
rights = element_rights(conn, actor, element, context)
if not rights.read:
raise not_found()
if not rights.edit:
raise forbidden()
conn.execute(
"DELETE FROM element_references WHERE element_id = %s AND refers_to_element_id = %s",
(element_id, refers_to_element_id),
)
def set_content_order(
conn,
actor: UUID,