Apply the code reviewer suggestion of abstractmethod
This commit is contained in:
@@ -12,12 +12,12 @@ class AuthProvider(ABC):
|
|||||||
|
|
||||||
Returns User if authentication succeeds, None otherwise.
|
Returns User if authentication succeeds, None otherwise.
|
||||||
"""
|
"""
|
||||||
...
|
raise NotImplementedError
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
async def get_user(self, user_id: str) -> "User | None":
|
async def get_user(self, user_id: str) -> "User | None":
|
||||||
"""Retrieve user by ID."""
|
"""Retrieve user by ID."""
|
||||||
...
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
# Import User at runtime to avoid circular imports
|
# Import User at runtime to avoid circular imports
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class UserRepository(ABC):
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: If email already exists
|
ValueError: If email already exists
|
||||||
"""
|
"""
|
||||||
...
|
raise NotImplementedError
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
async def get_user_by_id(self, user_id: str) -> User | None:
|
async def get_user_by_id(self, user_id: str) -> User | None:
|
||||||
@@ -47,7 +47,7 @@ class UserRepository(ABC):
|
|||||||
Returns:
|
Returns:
|
||||||
User if found, None otherwise
|
User if found, None otherwise
|
||||||
"""
|
"""
|
||||||
...
|
raise NotImplementedError
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
async def get_user_by_email(self, email: str) -> User | None:
|
async def get_user_by_email(self, email: str) -> User | None:
|
||||||
@@ -59,7 +59,7 @@ class UserRepository(ABC):
|
|||||||
Returns:
|
Returns:
|
||||||
User if found, None otherwise
|
User if found, None otherwise
|
||||||
"""
|
"""
|
||||||
...
|
raise NotImplementedError
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
async def update_user(self, user: User) -> User:
|
async def update_user(self, user: User) -> User:
|
||||||
@@ -81,12 +81,12 @@ class UserRepository(ABC):
|
|||||||
@abstractmethod
|
@abstractmethod
|
||||||
async def count_users(self) -> int:
|
async def count_users(self) -> int:
|
||||||
"""Return total number of registered users."""
|
"""Return total number of registered users."""
|
||||||
...
|
raise NotImplementedError
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
async def count_admin_users(self) -> int:
|
async def count_admin_users(self) -> int:
|
||||||
"""Return number of users with system_role == 'admin'."""
|
"""Return number of users with system_role == 'admin'."""
|
||||||
...
|
raise NotImplementedError
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
async def get_user_by_oauth(self, provider: str, oauth_id: str) -> User | None:
|
async def get_user_by_oauth(self, provider: str, oauth_id: str) -> User | None:
|
||||||
@@ -99,4 +99,4 @@ class UserRepository(ABC):
|
|||||||
Returns:
|
Returns:
|
||||||
User if found, None otherwise
|
User if found, None otherwise
|
||||||
"""
|
"""
|
||||||
...
|
raise NotImplementedError
|
||||||
|
|||||||
Reference in New Issue
Block a user