diff --git a/backend/common/enums.py b/backend/common/enums.py index 174a17b1b..5b1cbeac8 100644 --- a/backend/common/enums.py +++ b/backend/common/enums.py @@ -103,14 +103,6 @@ class StatusType(IntEnum): enable = 1 -class UserSocialType(StrEnum): - """用户社交类型""" - - github = 'GitHub' - google = 'Google' - linux_do = 'LinuxDo' - - class FileType(StrEnum): """文件类型""" diff --git a/backend/plugin/oauth2/api/v1/github.py b/backend/plugin/oauth2/api/v1/github.py index 70226eb5f..20cd0e61f 100644 --- a/backend/plugin/oauth2/api/v1/github.py +++ b/backend/plugin/oauth2/api/v1/github.py @@ -5,10 +5,10 @@ from fastapi_oauth20 import FastAPIOAuth20, GitHubOAuth20 from starlette.responses import RedirectResponse -from backend.common.enums import UserSocialType from backend.common.response.response_schema import ResponseSchemaModel, response_base from backend.core.conf import settings from backend.database.db import CurrentSessionTransaction +from backend.plugin.oauth2.enums import UserSocialType from backend.plugin.oauth2.service.oauth2_service import oauth2_service router = APIRouter() diff --git a/backend/plugin/oauth2/api/v1/google.py b/backend/plugin/oauth2/api/v1/google.py index 4a649f9ef..0456b9218 100644 --- a/backend/plugin/oauth2/api/v1/google.py +++ b/backend/plugin/oauth2/api/v1/google.py @@ -5,10 +5,10 @@ from fastapi_oauth20 import FastAPIOAuth20, GoogleOAuth20 from starlette.responses import RedirectResponse -from backend.common.enums import UserSocialType from backend.common.response.response_schema import ResponseSchemaModel, response_base from backend.core.conf import settings from backend.database.db import CurrentSessionTransaction +from backend.plugin.oauth2.enums import UserSocialType from backend.plugin.oauth2.service.oauth2_service import oauth2_service router = APIRouter() diff --git a/backend/plugin/oauth2/api/v1/linux_do.py b/backend/plugin/oauth2/api/v1/linux_do.py index 3152584ad..97f2f87b2 100644 --- a/backend/plugin/oauth2/api/v1/linux_do.py +++ b/backend/plugin/oauth2/api/v1/linux_do.py @@ -5,10 +5,10 @@ from fastapi_oauth20 import FastAPIOAuth20, LinuxDoOAuth20 from starlette.responses import RedirectResponse -from backend.common.enums import UserSocialType from backend.common.response.response_schema import ResponseSchemaModel, response_base from backend.core.conf import settings from backend.database.db import CurrentSessionTransaction +from backend.plugin.oauth2.enums import UserSocialType from backend.plugin.oauth2.service.oauth2_service import oauth2_service router = APIRouter() diff --git a/backend/plugin/oauth2/enums.py b/backend/plugin/oauth2/enums.py new file mode 100644 index 000000000..abd68bd6e --- /dev/null +++ b/backend/plugin/oauth2/enums.py @@ -0,0 +1,9 @@ +from backend.common.enums import StrEnum + + +class UserSocialType(StrEnum): + """用户社交类型""" + + github = 'GitHub' + google = 'Google' + linux_do = 'LinuxDo' diff --git a/backend/plugin/oauth2/schema/user_social.py b/backend/plugin/oauth2/schema/user_social.py index c41842a46..3e2ece918 100644 --- a/backend/plugin/oauth2/schema/user_social.py +++ b/backend/plugin/oauth2/schema/user_social.py @@ -1,7 +1,7 @@ from pydantic import Field -from backend.common.enums import UserSocialType from backend.common.schema import SchemaBase +from backend.plugin.oauth2.enums import UserSocialType class UserSocialSchemaBase(SchemaBase): diff --git a/backend/plugin/oauth2/service/oauth2_service.py b/backend/plugin/oauth2/service/oauth2_service.py index a7fffc8df..cfe7f8bd3 100644 --- a/backend/plugin/oauth2/service/oauth2_service.py +++ b/backend/plugin/oauth2/service/oauth2_service.py @@ -9,12 +9,13 @@ from backend.app.admin.schema.user import AddOAuth2UserParam from backend.app.admin.service.login_log_service import login_log_service from backend.common.context import ctx -from backend.common.enums import LoginLogStatusType, UserSocialType +from backend.common.enums import LoginLogStatusType from backend.common.i18n import t from backend.common.security import jwt from backend.core.conf import settings from backend.database.redis import redis_client from backend.plugin.oauth2.crud.crud_user_social import user_social_dao +from backend.plugin.oauth2.enums import UserSocialType from backend.plugin.oauth2.schema.user_social import CreateUserSocialParam from backend.utils.timezone import timezone