refactor(backend): 重构后端代码 wave 3
This commit is contained in:
1 parent
affe139bf9
commit
8415653365
97 files changed
+4673
-6164
No files matched your search
@@ -0,0 +1,40 @@
|
||||
"""
|
||||
api/user/auth.py
|
||||
|
||||
用途:用户认证 Blueprint 的兼容门面与路由装配入口。
|
||||
依赖:auth_local、auth_casdoor、auth_wecom、auth_password_reset、auth_support。
|
||||
逻辑:api/user/__init__.py 从此模块导出 auth_bp;各职责路由在独立模块注册,历史测试仍可替换本模块私有符号。
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from types import ModuleType
|
||||
|
||||
from flask import Blueprint
|
||||
|
||||
from . import auth_support as _support
|
||||
|
||||
auth_bp = Blueprint('user_auth', __name__)
|
||||
|
||||
|
||||
class _AuthCompatModule(ModuleType):
|
||||
"""将历史 monkeypatch 同步到共享认证操作,保持测试替身入口稳定。"""
|
||||
|
||||
def __setattr__(self, name: str, value: object) -> None:
|
||||
super().__setattr__(name, value)
|
||||
if hasattr(_support, name):
|
||||
setattr(_support, name, value)
|
||||
|
||||
|
||||
sys.modules[__name__].__class__ = _AuthCompatModule
|
||||
|
||||
|
||||
def __getattr__(name: str):
|
||||
"""兼容导出共享认证操作与历史测试替身点。"""
|
||||
return getattr(_support, name)
|
||||
|
||||
|
||||
# Importing modules registers their narrow route groups on the shared Blueprint.
|
||||
from . import auth_casdoor, auth_local, auth_password_reset, auth_wecom # noqa: E402, F401
|
||||
|
||||
__all__ = ['auth_bp']
|
||||
Reference in new issue
Block a user