chore: initial commit — leaudit-platform project skeleton

17-table PostgreSQL schema with full Chinese column comments,
FastAPI project structure (admin/common/modules),
DSL rule files, and schema migration scripts.
This commit is contained in:
wren
2026-04-27 16:48:22 +08:00
commit 535d97a70c
142 changed files with 25219 additions and 0 deletions
@@ -0,0 +1,10 @@
"""SQLAlchemy 声明式基类。"""
from __future__ import annotations
from sqlalchemy.orm import DeclarativeBase
class Base(DeclarativeBase):
"""SQLAlchemy 声明式基类。"""
pass
@@ -0,0 +1,21 @@
"""SQLAlchemy 异步引擎和 session 工厂。"""
from __future__ import annotations
from contextlib import asynccontextmanager
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
from fastapi_admin.config import ASYNCPG_DATABASE_URL
_engine = create_async_engine(ASYNCPG_DATABASE_URL, echo=False, pool_size=20, max_overflow=10)
_AsyncSessionFactory = async_sessionmaker(_engine, class_=AsyncSession, expire_on_commit=False)
@asynccontextmanager
async def GetAsyncSession():
"""获取异步数据库 session(上下文管理器)。"""
async with _AsyncSessionFactory() as session:
yield session
await session.commit()