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

8 statements  

« prev     ^ index     » next       coverage.py v7.3.0, created at 2023-09-05 17:55 +0000

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

2from abc import abstractmethod 

3 

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

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

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

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

8 

9 

10class UserQuery(Query): 

11 """Interface for a user query.""" 

12 

13 @abstractmethod 

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

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

16 raise NotImplementedError 

17 

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

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

20 raise NotImplementedError 

21 

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

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

24 raise NotImplementedError