Files
resolutionflow/backend/app/schemas/sidebar.py
chihlasm cf23107735 fix(escalations): add sidebar badge count + show all team escalations
- Add escalation_count to sidebar stats (team-wide requesting_escalation)
- Show badge on Escalations nav item in sidebar
- Remove user_id filter from escalation queue — show all team escalations
  including your own (needed for solo users and visibility)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 04:41:27 +00:00

47 lines
1.1 KiB
Python

"""Schemas for sidebar stats endpoint."""
from datetime import datetime
from typing import Optional
from uuid import UUID
from pydantic import BaseModel
class SidebarActiveSession(BaseModel):
"""An active or paused session for the activity feed."""
session_id: UUID
tree_name: str
tree_id: UUID
tree_type: str
started_at: datetime
ticket_number: Optional[str] = None
psa_ticket_id: Optional[str] = None
class SidebarRecentSession(BaseModel):
"""A recently completed session for the activity feed."""
session_id: UUID
tree_name: str
tree_id: UUID
tree_type: str
completed_at: datetime
class SidebarTreeCounts(BaseModel):
"""Tree counts for All Flows sub-items."""
total: int
troubleshooting: int
procedural: int
maintenance: int
class SidebarStatsResponse(BaseModel):
"""Response for GET /sessions/sidebar-stats."""
resolved_today: int
active_count: int
total_session_minutes_today: int
escalation_count: int = 0
tree_counts: SidebarTreeCounts
active_sessions: list[SidebarActiveSession]
recent_completions: list[SidebarRecentSession]