Coverage for kwai/modules/identity/user_invitations/user_invitation_query.py: 100%

11 statements  

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

1"""Module that defines an interface for a user invitation query.""" 

2from abc import ABC 

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.local_timestamp import LocalTimestamp 

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

8from kwai.modules.identity.user_invitations.user_invitation import ( 

9 UserInvitationIdentifier, 

10) 

11 

12 

13class UserInvitationQuery(Query, ABC): 

14 """An interface for querying user invitations.""" 

15 

16 def filter_by_id(self, id_: UserInvitationIdentifier) -> "UserInvitationQuery": 

17 """Add a filter on the user invitation for id. 

18 

19 Args: 

20 id_(UserInvitationIdentifier): An id of a user invitation. 

21 

22 Returns: 

23 (UserInvitationQuery): The active query 

24 """ 

25 raise NotImplementedError 

26 

27 def filter_by_uuid(self, uuid: UniqueId) -> "UserInvitationQuery": 

28 """Add a filter on the user invitation for the unique id. 

29 

30 Args: 

31 uuid(UniqueId): A unique id of a user invitation. 

32 

33 Returns: 

34 (UserInvitationQuery): The active query 

35 """ 

36 raise NotImplementedError 

37 

38 def filter_by_email(self, email: EmailAddress) -> "UserInvitationQuery": 

39 """Add a filter on the user invitation for the email address. 

40 

41 Args: 

42 email: An email address. 

43 

44 Returns: 

45 The active query 

46 """ 

47 raise NotImplementedError 

48 

49 def filter_active(self, timestamp: LocalTimestamp) -> "UserInvitationQuery": 

50 """Add a filter to only return the active invitations at the given time. 

51 

52 Returns: 

53 The active query 

54 """ 

55 raise NotImplementedError