cf5518c7ec
Closes the rule #8 gap at the API layer: PATCH endpoints + service updates for Tree (name/description/visibility), Source, Citation (page/detail/confidence), Relationship (qualifier/notes), and Media (title/attachment) — editor-gated and audited. Every core entity now has create/read/update/delete. Edit UIs for these land in the frontend batch. 37 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Justin Paul <justin@jpaul.me>
34 lines
856 B
Python
34 lines
856 B
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
from app.models.enums import ParentChildQualifier, RelationshipType
|
|
|
|
|
|
class RelationshipCreate(BaseModel):
|
|
type: RelationshipType
|
|
person_from_id: uuid.UUID
|
|
person_to_id: uuid.UUID
|
|
# Only meaningful for parent_child edges (from = parent, to = child).
|
|
qualifier: ParentChildQualifier | None = None
|
|
notes: str | None = None
|
|
|
|
|
|
class RelationshipUpdate(BaseModel):
|
|
qualifier: ParentChildQualifier | None = None
|
|
notes: str | None = None
|
|
|
|
|
|
class RelationshipRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: uuid.UUID
|
|
tree_id: uuid.UUID
|
|
type: RelationshipType
|
|
person_from_id: uuid.UUID
|
|
person_to_id: uuid.UUID
|
|
qualifier: ParentChildQualifier | None
|
|
notes: str | None
|
|
created_at: datetime
|