This commit is contained in:
jxxghp 2024-04-23 10:02:15 +08:00
parent 0cbe8f5cdc
commit 3002bf4dd2
2 changed files with 5 additions and 3 deletions

View File

@ -184,6 +184,7 @@ def read_user_by_id(
)
return user
@router.get("/config/{key}", summary="查询用户配置", response_model=schemas.Response)
def get_config(key: str,
current_user: User = Depends(get_current_active_user)):
@ -195,9 +196,10 @@ def get_config(key: str,
"value": value
})
@router.post("/config/{key}", summary="更新用户配置", response_model=schemas.Response)
def set_config(key: str, value: Union[list, dict, bool, int, str] = None,
current_user: User = Depends(get_current_active_user)):
current_user: User = Depends(get_current_active_user)):
"""
更新用户配置
"""

View File

@ -1,5 +1,5 @@
import json
from typing import Any, Union, Dict
from typing import Any, Union, Dict, Optional
from app.db import DbOper
from app.db.models.userconfig import UserConfig
@ -76,7 +76,7 @@ class UserConfigOper(DbOper, metaclass=Singleton):
user_cache[key] = value
self.__USERCONF = cache
def __get_config_caches(self, username: str) -> Dict[str, Any]:
def __get_config_caches(self, username: str) -> Optional[Dict[str, Any]]:
"""
获取配置缓存
"""