Add events and relationships API (Phase 1: flesh out the graph)
Events (create/list-per-person/soft-delete) and relationships (create/list-per-person/soft-delete) through the layered stack: editor-gated writes, privacy-engine reads, audit on every change. Events carry exactly one subject (person XOR partnership); relationships are typed qualified edges (parent_child gets a biological/adoptive/step/foster/donor/guardian qualifier). Adds a single-person GET. 18 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Justin Paul <justin@jpaul.me>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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 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
|
||||
Reference in New Issue
Block a user