Features: - FastAPI backend with JWT authentication - MySQL database with SQLAlchemy ORM - KPI workflow: draft → pending → approved → evaluation → completed - Ollama LLM API integration for AI features - Gitea API integration for version control - Complete API endpoints for KPI, dashboard, notifications Tables: KPI_D_* prefix naming convention 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
75 lines
1.3 KiB
Python
75 lines
1.3 KiB
Python
"""
|
|
儀表板 Schemas
|
|
"""
|
|
from datetime import datetime
|
|
from typing import Optional, List
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class ProgressStats(BaseModel):
|
|
"""進度統計"""
|
|
|
|
total: int
|
|
draft: int
|
|
pending: int
|
|
approved: int
|
|
self_eval: int
|
|
manager_eval: int
|
|
completed: int
|
|
|
|
|
|
class DistributionItem(BaseModel):
|
|
"""分佈項目"""
|
|
|
|
label: str
|
|
count: int
|
|
percentage: float
|
|
|
|
|
|
class TrendItem(BaseModel):
|
|
"""趨勢項目"""
|
|
|
|
period: str
|
|
average_score: float
|
|
completed_count: int
|
|
|
|
|
|
class DashboardAlertResponse(BaseModel):
|
|
"""儀表板警示回應"""
|
|
|
|
id: int
|
|
alert_type: str
|
|
severity: str
|
|
title: str
|
|
description: Optional[str]
|
|
related_sheet_id: Optional[int]
|
|
related_employee_id: Optional[int]
|
|
is_resolved: bool
|
|
created_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class DashboardProgressResponse(BaseModel):
|
|
"""儀表板進度回應"""
|
|
|
|
period_code: str
|
|
period_name: str
|
|
stats: ProgressStats
|
|
completion_rate: float
|
|
|
|
|
|
class DashboardDistributionResponse(BaseModel):
|
|
"""儀表板分佈回應"""
|
|
|
|
by_department: List[DistributionItem]
|
|
by_status: List[DistributionItem]
|
|
by_score_range: List[DistributionItem]
|
|
|
|
|
|
class DashboardTrendsResponse(BaseModel):
|
|
"""儀表板趨勢回應"""
|
|
|
|
trends: List[TrendItem]
|