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>
88 lines
1.6 KiB
Python
88 lines
1.6 KiB
Python
"""
|
|
員工 Schemas
|
|
"""
|
|
from datetime import date, datetime
|
|
from typing import Optional
|
|
from pydantic import BaseModel, EmailStr
|
|
|
|
|
|
class DepartmentBase(BaseModel):
|
|
"""部門基本資訊"""
|
|
|
|
id: int
|
|
code: str
|
|
name: str
|
|
level: str
|
|
|
|
|
|
class DepartmentResponse(DepartmentBase):
|
|
"""部門回應"""
|
|
|
|
parent_id: Optional[int]
|
|
is_active: bool
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class EmployeeBase(BaseModel):
|
|
"""員工基本資訊"""
|
|
|
|
id: int
|
|
employee_no: str
|
|
name: str
|
|
email: str
|
|
|
|
|
|
class EmployeeSimple(EmployeeBase):
|
|
"""員工簡要資訊"""
|
|
|
|
job_title: Optional[str]
|
|
role: str
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class EmployeeResponse(EmployeeBase):
|
|
"""員工回應"""
|
|
|
|
department_id: int
|
|
department: DepartmentBase
|
|
manager_id: Optional[int]
|
|
manager: Optional[EmployeeBase]
|
|
job_title: Optional[str]
|
|
role: str
|
|
status: str
|
|
hire_date: Optional[date]
|
|
created_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class EmployeeCreate(BaseModel):
|
|
"""建立員工"""
|
|
|
|
employee_no: str
|
|
name: str
|
|
email: EmailStr
|
|
password: str
|
|
department_id: int
|
|
manager_id: Optional[int] = None
|
|
job_title: Optional[str] = None
|
|
role: str = "employee"
|
|
hire_date: Optional[date] = None
|
|
|
|
|
|
class EmployeeUpdate(BaseModel):
|
|
"""更新員工"""
|
|
|
|
name: Optional[str] = None
|
|
email: Optional[EmailStr] = None
|
|
department_id: Optional[int] = None
|
|
manager_id: Optional[int] = None
|
|
job_title: Optional[str] = None
|
|
role: Optional[str] = None
|
|
status: Optional[str] = None
|