feat(user-preference): add user preference support (#55)

APIs:

- GET `/api/private/user/preferences`: Get current user's preferences.
- PATCH `/api/private/user/preferences`: Modify current user's preferences. (body: Preferences)
- PUT `/api/private/user/preferences`: Overwrite current user's preferences. (body: Preferences)
- DELETE `/api/private/user/preferences`: Reset current user's preferences. (body: list[str])
  - body specifies the content to be reset. If body is empty, reset all preferences.

User:

- `User.g0v0_playmode`: show the special ruleset like `OSURX`, and custom rulesets in the future.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
MingxuanGame
2025-10-06 20:57:17 +08:00
committed by GitHub
parent febc1d761f
commit 10caa82320
6 changed files with 459 additions and 17 deletions

View File

@@ -68,6 +68,7 @@ from .user_account_history import (
UserAccountHistoryType,
)
from .user_login_log import UserLoginLog
from .user_preference import UserPreference
from .verification import EmailVerification, LoginSession, LoginSessionResp, TrustedDevice, TrustedDeviceResp
__all__ = [
@@ -143,6 +144,7 @@ __all__ = [
"UserAchievementResp",
"UserLoginLog",
"UserNotification",
"UserPreference",
"UserResp",
"UserStatistics",
"UserStatisticsResp",