Unterscheide Eingang und Ausgang an der Einbindung und ermoegliche Umbenennen, Archivieren, Loeschen und Verschieben.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
20625b4596
commit
ad6240a5da
27 files changed
+1191
-88
No files matched your search
@@ -43,6 +43,11 @@ from app.api.schemas import (
|
||||
CaseLinkIn,
|
||||
CasePatch,
|
||||
ChapterDateIn,
|
||||
ChapterDeleteIn,
|
||||
ChapterTitleIn,
|
||||
CommunicationIn,
|
||||
MatterMoveIn,
|
||||
RecordDeleteIn,
|
||||
ChapterIn,
|
||||
ChapterOrderIn,
|
||||
CrossLinkIn,
|
||||
@@ -100,8 +105,11 @@ from app.ops import (
|
||||
create_matter,
|
||||
create_note,
|
||||
create_task,
|
||||
delete_case,
|
||||
delete_chapter,
|
||||
delete_cross_link,
|
||||
delete_element,
|
||||
delete_matter,
|
||||
detach_binding,
|
||||
fulfill_deadline,
|
||||
grant_access,
|
||||
@@ -118,9 +126,12 @@ from app.ops import (
|
||||
patch_task,
|
||||
revoke_grant,
|
||||
move_binding_chapter,
|
||||
move_matter,
|
||||
reorder_bindings,
|
||||
rename_chapter,
|
||||
reorder_chapters,
|
||||
set_chapter_date,
|
||||
set_communication_direction,
|
||||
set_content_order,
|
||||
set_exception,
|
||||
unlink_matter_case,
|
||||
@@ -688,6 +699,92 @@ def post_matter_chapter_order(
|
||||
return {"version": version}
|
||||
|
||||
|
||||
@router.patch("/api/v1/chapters/{chapter_id}/title")
|
||||
def patch_chapter_title(
|
||||
chapter_id: UUID,
|
||||
body: ChapterTitleIn,
|
||||
principal: Principal = Depends(get_principal),
|
||||
conn: Connection = Depends(get_conn),
|
||||
):
|
||||
version = rename_chapter(
|
||||
conn, principal.account_id, chapter_id, body.expected_version, body.title, _ctx_model(body.context)
|
||||
)
|
||||
return {"version": version, "title": body.title}
|
||||
|
||||
|
||||
@router.post("/api/v1/chapters/{chapter_id}/delete")
|
||||
def post_delete_chapter(
|
||||
chapter_id: UUID,
|
||||
body: ChapterDeleteIn,
|
||||
principal: Principal = Depends(get_principal),
|
||||
conn: Connection = Depends(get_conn),
|
||||
):
|
||||
version = delete_chapter(
|
||||
conn, principal.account_id, chapter_id, body.expected_version, _ctx_model(body.context)
|
||||
)
|
||||
return {"version": version}
|
||||
|
||||
|
||||
@router.post("/api/v1/cases/{case_id}/delete")
|
||||
def post_delete_case(
|
||||
case_id: UUID,
|
||||
body: RecordDeleteIn,
|
||||
principal: Principal = Depends(get_principal),
|
||||
conn: Connection = Depends(get_conn),
|
||||
):
|
||||
delete_case(conn, principal.account_id, case_id, body.expected_version)
|
||||
return {"ok": True}
|
||||
|
||||
|
||||
@router.post("/api/v1/matters/{matter_id}/delete")
|
||||
def post_delete_matter(
|
||||
matter_id: UUID,
|
||||
body: RecordDeleteIn,
|
||||
principal: Principal = Depends(get_principal),
|
||||
conn: Connection = Depends(get_conn),
|
||||
):
|
||||
delete_matter(conn, principal.account_id, matter_id, body.expected_version, _ctx_model(body.context))
|
||||
return {"ok": True}
|
||||
|
||||
|
||||
@router.post("/api/v1/matters/{matter_id}/move")
|
||||
def post_move_matter(
|
||||
matter_id: UUID,
|
||||
body: MatterMoveIn,
|
||||
principal: Principal = Depends(get_principal),
|
||||
conn: Connection = Depends(get_conn),
|
||||
):
|
||||
matter = move_matter(
|
||||
conn,
|
||||
principal.account_id,
|
||||
matter_id,
|
||||
body.expected_version,
|
||||
_ctx_model(body.context),
|
||||
body.case_id,
|
||||
body.parent_matter_id,
|
||||
body.clear_parent,
|
||||
)
|
||||
return matter_summary(conn, principal.account_id, matter)
|
||||
|
||||
|
||||
@router.patch("/api/v1/bindings/{binding_id}/communication")
|
||||
def patch_communication(
|
||||
binding_id: UUID,
|
||||
body: CommunicationIn,
|
||||
principal: Principal = Depends(get_principal),
|
||||
conn: Connection = Depends(get_conn),
|
||||
):
|
||||
element = set_communication_direction(
|
||||
conn,
|
||||
principal.account_id,
|
||||
binding_id,
|
||||
body.expected_version,
|
||||
body.direction,
|
||||
_ctx_model(body.context),
|
||||
)
|
||||
return {"version": element["version"], "direction": body.direction}
|
||||
|
||||
|
||||
@router.patch("/api/v1/chapters/{chapter_id}")
|
||||
def patch_chapter_date(
|
||||
chapter_id: UUID,
|
||||
@@ -799,6 +896,7 @@ def post_note(body: NoteIn, principal: Principal = Depends(get_principal), conn:
|
||||
body.dates.document_on if body.dates else None,
|
||||
body.dates.sent_on if body.dates else None,
|
||||
body.dates.received_on if body.dates else None,
|
||||
body.communication_direction,
|
||||
)
|
||||
element = created["element"]
|
||||
return _created(
|
||||
@@ -899,6 +997,7 @@ def post_file(
|
||||
document_on: str | None = Form(default=None),
|
||||
sent_on: str | None = Form(default=None),
|
||||
received_on: str | None = Form(default=None),
|
||||
communication_direction: str | None = Form(default=None),
|
||||
principal: Principal = Depends(get_principal),
|
||||
conn: Connection = Depends(get_conn),
|
||||
):
|
||||
@@ -928,6 +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,
|
||||
)
|
||||
return _created(f"/api/v1/elements/{element['id']}", {"id": str(element["id"]), "title": element["title"]})
|
||||
|
||||
|
||||
@@ -93,6 +93,36 @@ class ChapterDateIn(APIModel):
|
||||
context: ContextIn | None = None
|
||||
|
||||
|
||||
class ChapterTitleIn(APIModel):
|
||||
expected_version: int = Field(ge=1)
|
||||
title: str = Field(min_length=1, max_length=200)
|
||||
context: ContextIn | None = None
|
||||
|
||||
|
||||
class ChapterDeleteIn(APIModel):
|
||||
expected_version: int = Field(ge=1)
|
||||
context: ContextIn | None = None
|
||||
|
||||
|
||||
class RecordDeleteIn(APIModel):
|
||||
expected_version: int = Field(ge=1)
|
||||
context: ContextIn | None = None
|
||||
|
||||
|
||||
class MatterMoveIn(APIModel):
|
||||
expected_version: int = Field(ge=1)
|
||||
context: ContextIn | None = None
|
||||
case_id: UUID | None = None
|
||||
parent_matter_id: UUID | None = None
|
||||
clear_parent: bool = False
|
||||
|
||||
|
||||
class CommunicationIn(APIModel):
|
||||
expected_version: int = Field(ge=1)
|
||||
direction: Literal["in", "out"] | None = None
|
||||
context: ContextIn | None = None
|
||||
|
||||
|
||||
class MatterIn(APIModel):
|
||||
title: str = Field(min_length=1, max_length=200)
|
||||
parent_matter_id: UUID | None = None
|
||||
@@ -146,6 +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
|
||||
|
||||
|
||||
class ContentOrderIn(APIModel):
|
||||
|
||||
Reference in new issue
Block a user