Initial commit: Backend API Phase 1a complete
- FastAPI backend with JWT auth - PostgreSQL database schema - Trees and Sessions CRUD APIs - Export functionality (Markdown, Text, HTML) - Docker setup for local development - Alembic migrations
This commit is contained in:
51
backend/app/schemas/session.py
Normal file
51
backend/app/schemas/session.py
Normal file
@@ -0,0 +1,51 @@
|
||||
from datetime import datetime
|
||||
from typing import Optional, Any
|
||||
from uuid import UUID
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class DecisionRecord(BaseModel):
|
||||
node_id: str
|
||||
question: Optional[str] = None
|
||||
answer: Optional[str] = None
|
||||
action_performed: Optional[str] = None
|
||||
notes: Optional[str] = None
|
||||
automation_used: Optional[bool] = False
|
||||
timestamp: datetime
|
||||
attachments: list[str] = Field(default_factory=list)
|
||||
|
||||
|
||||
class SessionCreate(BaseModel):
|
||||
tree_id: UUID
|
||||
ticket_number: Optional[str] = Field(None, max_length=100)
|
||||
client_name: Optional[str] = Field(None, max_length=255)
|
||||
|
||||
|
||||
class SessionUpdate(BaseModel):
|
||||
path_taken: Optional[list[str]] = None
|
||||
decisions: Optional[list[DecisionRecord]] = None
|
||||
ticket_number: Optional[str] = Field(None, max_length=100)
|
||||
client_name: Optional[str] = Field(None, max_length=255)
|
||||
|
||||
|
||||
class SessionResponse(BaseModel):
|
||||
id: UUID
|
||||
tree_id: UUID
|
||||
user_id: UUID
|
||||
tree_snapshot: dict[str, Any]
|
||||
path_taken: list[str]
|
||||
decisions: list[dict[str, Any]]
|
||||
started_at: datetime
|
||||
completed_at: Optional[datetime] = None
|
||||
ticket_number: Optional[str] = None
|
||||
client_name: Optional[str] = None
|
||||
exported: bool
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class SessionExport(BaseModel):
|
||||
format: str = Field(default="markdown", pattern="^(text|markdown|html)$")
|
||||
include_timestamps: bool = True
|
||||
include_tree_info: bool = True
|
||||
Reference in New Issue
Block a user