Coverage for src/kwai/modules/identity/users/user_query.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.6.10, created at 2024-01-01 00:00 +0000

1"""Module that defines the interface for a user query.""" 

2 

3from abc import abstractmethod 

4 

5from kwai.core.domain.repository.query import Query 

6from kwai.core.domain.value_objects.email_address import EmailAddress 

7from kwai.core.domain.value_objects.unique_id import UniqueId 

8from kwai.modules.identity.users.user import UserIdentifier 

9 

10 

11class UserQuery(Query): 

12 """Interface for a user query.""" 

13 

14 @abstractmethod 

15 def filter_by_id(self, id_: UserIdentifier) -> "UserQuery": 

16 """Add a filter to the query for the id of the user.""" 

17 raise NotImplementedError 

18 

19 def filter_by_uuid(self, uuid: UniqueId) -> "UserQuery": 

20 """Add a filter for a user with the given unique id.""" 

21 raise NotImplementedError 

22 

23 def filter_by_email(self, email: EmailAddress) -> "UserQuery": 

24 """Add a filter for a user with the given email address.""" 

25 raise NotImplementedError