单元测试:新建用户与用户组

This commit is contained in:
2025-07-14 15:13:05 +08:00
parent e011a1ea0e
commit 557a50f539
26 changed files with 396 additions and 242 deletions

View File

@@ -1,4 +1,5 @@
from fastapi.security import OAuth2PasswordBearer
from models.setting import Setting
oauth2_scheme = OAuth2PasswordBearer(
scheme_name='获取 JWT Bearer 令牌',
@@ -6,4 +7,14 @@ oauth2_scheme = OAuth2PasswordBearer(
tokenUrl="/api/user/session",
)
SECRET_KEY = ''
SECRET_KEY = ''
async def load_secret_key() -> None:
"""
从数据库读取 JWT 的密钥。
:param key: 用于加密和解密 JWT 的密钥
:type key: str
"""
global SECRET_KEY
SECRET_KEY = await Setting.get(type='auth', name='secret_key')