Coverage for src/lexigram/admin/auth/store/base.py: 100%
15 statements
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-21 14:26 +0800
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-21 14:26 +0800
1"""
2Base admin user store interface.
3"""
5from __future__ import annotations
7from abc import ABC, abstractmethod
8from typing import TYPE_CHECKING
10if TYPE_CHECKING:
11 from lexigram.contracts.auth import AuthenticatedUserProtocol
14class AbstractAdminUserStore(ABC):
15 """Abstract base class for admin user stores.
17 Provides the interface for admin user operations including
18 authentication, user lookup, and user management.
19 """
21 @abstractmethod
22 async def get_by_id(self, user_id: str) -> AuthenticatedUserProtocol | None:
23 """Get user by ID."""
24 ...
26 @abstractmethod
27 async def get_by_email(self, email: str) -> AuthenticatedUserProtocol | None:
28 """Get user by email address."""
29 ...
31 @abstractmethod
32 async def get_by_username(self, username: str) -> AuthenticatedUserProtocol | None:
33 """Get user by username."""
34 ...
36 @abstractmethod
37 async def authenticate(
38 self, email: str, password: str
39 ) -> AuthenticatedUserProtocol | None:
40 """Authenticate user by email and password."""
41 ...
43 @abstractmethod
44 async def count(self) -> int:
45 """Get total number of users."""
46 ...
49__all__ = ["AbstractAdminUserStore"]