Halte die Richtung an der einzelnen Einbindung und mach sie in der Uebersicht waehlbar.
Deploy Development / deploy (push) Successful in 28s
Deploy Development / deploy (push) Successful in 28s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
2664021e7f
commit
95381030bc
12 files changed
+185
-52
No files matched your search
@@ -1027,7 +1027,7 @@ def post_file(
|
||||
settings.media_root,
|
||||
settings.upload_max_bytes,
|
||||
request.state.cleanup_files,
|
||||
communication_direction if communication_direction in {"in", "out"} else None,
|
||||
communication_direction if communication_direction in {"in", "out", "local"} else None,
|
||||
)
|
||||
return _created(f"/api/v1/elements/{element['id']}", {"id": str(element["id"]), "title": element["title"]})
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ class MatterMoveIn(APIModel):
|
||||
|
||||
class CommunicationIn(APIModel):
|
||||
expected_version: int = Field(ge=1)
|
||||
direction: Literal["in", "out"] | None = None
|
||||
direction: Literal["in", "out", "local"] | None = None
|
||||
context: ContextIn | None = None
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ class NoteIn(APIModel):
|
||||
placement: ContextIn | None = None
|
||||
chapter_id: UUID | None = None
|
||||
dates: DatesIn | None = None
|
||||
communication_direction: Literal["in", "out"] | None = None
|
||||
communication_direction: Literal["in", "out", "local"] | None = None
|
||||
|
||||
|
||||
class ContentOrderIn(APIModel):
|
||||
|
||||
+11
-5
@@ -665,10 +665,14 @@ def record_dates(conn, actor: UUID, scope_id: UUID, element_id: UUID, context: C
|
||||
audit(conn, actor, scope_id, "correspondence_recorded", "element", element_id, context)
|
||||
|
||||
|
||||
def chosen_direction(value: str | None) -> str | None:
|
||||
return value if value in ("in", "out", "local") else None
|
||||
|
||||
|
||||
def store_direction(conn, binding_id: UUID, direction: str | None, explicit: bool) -> None:
|
||||
if not explicit:
|
||||
return
|
||||
if direction not in (None, "in", "out"):
|
||||
if direction not in (None, "in", "out", "local"):
|
||||
raise unprocessable("Die Richtung ist ungültig.")
|
||||
conn.execute(
|
||||
"""
|
||||
@@ -703,7 +707,8 @@ def create_note(
|
||||
(element["id"], Json(document)),
|
||||
)
|
||||
binding = insert_binding(conn, element["id"], target.kind, target.id, chapter_id, actor)
|
||||
store_direction(conn, binding["id"], communication_direction, communication_direction in ("in", "out"))
|
||||
chosen = chosen_direction(communication_direction)
|
||||
store_direction(conn, binding["id"], chosen, chosen is not None)
|
||||
audit(conn, actor, scope_id, "note_created", "element", element["id"], rights_context or target)
|
||||
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)
|
||||
@@ -792,8 +797,8 @@ def create_external(conn, actor: UUID, scope_id: UUID, title: str, source: str,
|
||||
)
|
||||
binding = insert_binding(conn, element["id"], target.kind, target.id, chapter_id, actor)
|
||||
adopted = (detail or {}).get("direction") if source == "imap" else None
|
||||
chosen = communication_direction if communication_direction in ("in", "out") else adopted if adopted in ("in", "out") else None
|
||||
store_direction(conn, binding["id"], chosen, chosen in ("in", "out"))
|
||||
chosen = chosen_direction(communication_direction) or (adopted if adopted in ("in", "out") else None)
|
||||
store_direction(conn, binding["id"], chosen, chosen is not None)
|
||||
record_dates(conn, actor, scope_id, element["id"], rights_context or target, document_on, sent_on, received_on)
|
||||
audit(conn, actor, scope_id, "external_ref_added", "element", element["id"], rights_context or target)
|
||||
return element | {"binding_id": binding["id"]}
|
||||
@@ -837,7 +842,8 @@ def create_file(conn, actor: UUID, scope_id: UUID, title: str, filename: str, da
|
||||
(element["id"], asset_id),
|
||||
)
|
||||
binding = insert_binding(conn, element["id"], target.kind, target.id, chapter_id, actor)
|
||||
store_direction(conn, binding["id"], communication_direction, communication_direction in ("in", "out"))
|
||||
chosen = chosen_direction(communication_direction)
|
||||
store_direction(conn, binding["id"], chosen, chosen is not None)
|
||||
record_dates(conn, actor, scope_id, element["id"], rights_context or target, document_on, sent_on, received_on)
|
||||
audit(conn, actor, scope_id, "file_added", "element", element["id"], rights_context or target)
|
||||
return element | {"binding_id": binding["id"], "asset_id": asset_id}
|
||||
|
||||
@@ -198,7 +198,7 @@ def _exception(conn, kind: str, resource_id: UUID, context: Ctx | None) -> dict
|
||||
def communication_from_row(conn, binding: dict, element: dict) -> dict:
|
||||
"""Explicit binding direction wins. An adopted mailbox direction may prefill. Dates never do."""
|
||||
stored = binding.get("communication_direction")
|
||||
stored = stored if stored in ("in", "out") else None
|
||||
stored = stored if stored in ("in", "out", "local") else None
|
||||
if binding.get("direction_explicit"):
|
||||
return {"direction": stored, "explicit": True}
|
||||
source = None
|
||||
|
||||
Reference in new issue
Block a user