Major Features: - ✅ Multi-tenant architecture (tenant isolation) - ✅ Employee CRUD with lifecycle management (onboarding/offboarding) - ✅ Department tree structure with email domain management - ✅ Company info management (single-record editing) - ✅ System functions CRUD (permission management) - ✅ Email account management (multi-account per employee) - ✅ Keycloak SSO integration (auth.lab.taipei) - ✅ Redis session storage (10.1.0.254:6379) - Solves Cookie 4KB limitation - Cross-system session sharing - Sliding expiration (8 hours) - Automatic token refresh Technical Stack: Backend: - FastAPI + SQLAlchemy - PostgreSQL 16 (10.1.0.20:5433) - Keycloak Admin API integration - Docker Mailserver integration (SSH) - Alembic migrations Frontend: - Next.js 14 (App Router) - NextAuth 4 with Keycloak Provider - Redis session storage (ioredis) - Tailwind CSS Infrastructure: - Redis 7 (10.1.0.254:6379) - Session + Cache - Keycloak 26.1.0 (auth.lab.taipei) - Docker Mailserver (10.1.0.254) Architecture Highlights: - Session管理由 Keycloak + Redis 統一控制 - 支援多系統 (HR/WebMail/Calendar/Drive/Office) 共享 session - Token 自動刷新,異質服務整合 - 未來可無縫遷移到雲端 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
145 lines
2.9 KiB
Python
145 lines
2.9 KiB
Python
"""
|
||
API v1 主路由
|
||
"""
|
||
from fastapi import APIRouter
|
||
|
||
from app.api.v1 import (
|
||
auth,
|
||
tenants,
|
||
employees,
|
||
departments,
|
||
department_members,
|
||
roles,
|
||
# identities, # Removed: EmployeeIdentity and BusinessUnit models have been deleted
|
||
network_drives,
|
||
audit_logs,
|
||
email_accounts,
|
||
permissions,
|
||
lifecycle,
|
||
personal_service_settings,
|
||
emp_onboarding,
|
||
system_functions,
|
||
)
|
||
from app.api.v1.endpoints import installation, installation_phases
|
||
|
||
api_router = APIRouter()
|
||
|
||
# 認證
|
||
api_router.include_router(
|
||
auth.router,
|
||
prefix="/auth",
|
||
tags=["Authentication"]
|
||
)
|
||
|
||
# 租戶管理 (多租戶核心)
|
||
api_router.include_router(
|
||
tenants.router,
|
||
prefix="/tenants",
|
||
tags=["Tenants"]
|
||
)
|
||
|
||
# 員工管理
|
||
api_router.include_router(
|
||
employees.router,
|
||
prefix="/employees",
|
||
tags=["Employees"]
|
||
)
|
||
|
||
# 部門管理 (統一樹狀結構,取代原 business-units)
|
||
api_router.include_router(
|
||
departments.router,
|
||
prefix="/departments",
|
||
tags=["Departments"]
|
||
)
|
||
|
||
# 部門成員管理 (員工多部門歸屬)
|
||
api_router.include_router(
|
||
department_members.router,
|
||
prefix="/department-members",
|
||
tags=["Department Members"]
|
||
)
|
||
|
||
# 角色管理 (RBAC)
|
||
api_router.include_router(
|
||
roles.router,
|
||
prefix="/roles",
|
||
tags=["Roles & RBAC"]
|
||
)
|
||
|
||
# 身份管理 (已廢棄 API,底層 model 已刪除)
|
||
# api_router.include_router(
|
||
# identities.router,
|
||
# prefix="/identities",
|
||
# tags=["Employee Identities (Deprecated)"]
|
||
# )
|
||
|
||
# 網路硬碟管理
|
||
api_router.include_router(
|
||
network_drives.router,
|
||
prefix="/network-drives",
|
||
tags=["Network Drives"]
|
||
)
|
||
|
||
# 審計日誌
|
||
api_router.include_router(
|
||
audit_logs.router,
|
||
prefix="/audit-logs",
|
||
tags=["Audit Logs"]
|
||
)
|
||
|
||
# 郵件帳號管理
|
||
api_router.include_router(
|
||
email_accounts.router,
|
||
prefix="/email-accounts",
|
||
tags=["Email Accounts"]
|
||
)
|
||
|
||
# 系統權限管理
|
||
api_router.include_router(
|
||
permissions.router,
|
||
prefix="/permissions",
|
||
tags=["Permissions"]
|
||
)
|
||
|
||
# 員工生命週期管理
|
||
api_router.include_router(
|
||
lifecycle.router,
|
||
prefix="",
|
||
tags=["Employee Lifecycle"]
|
||
)
|
||
|
||
# 個人化服務設定管理
|
||
api_router.include_router(
|
||
personal_service_settings.router,
|
||
prefix="/personal-services",
|
||
tags=["Personal Service Settings"]
|
||
)
|
||
|
||
# 員工到職/離職流程 (v3.1 多租戶架構)
|
||
api_router.include_router(
|
||
emp_onboarding.router,
|
||
prefix="/emp-lifecycle",
|
||
tags=["Employee Onboarding (v3.1)"]
|
||
)
|
||
|
||
# 系統初始化與健康檢查
|
||
api_router.include_router(
|
||
installation.router,
|
||
prefix="/installation",
|
||
tags=["Installation & Health Check"]
|
||
)
|
||
|
||
# 系統階段轉換(Initialization/Operational/Transition)
|
||
api_router.include_router(
|
||
installation_phases.router,
|
||
prefix="/installation",
|
||
tags=["System Phase Management"]
|
||
)
|
||
|
||
# 系統功能管理
|
||
api_router.include_router(
|
||
system_functions.router,
|
||
prefix="/system-functions",
|
||
tags=["System Functions"]
|
||
)
|