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

11 statements  

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

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

2 

3from abc import ABC 

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.timestamp import Timestamp 

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

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

10 UserInvitationIdentifier, 

11) 

12 

13 

14class UserInvitationQuery(Query, ABC): 

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

16 

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

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

19 

20 Args: 

21 id_: An id of a user invitation. 

22 

23 Returns: 

24 The active query 

25 """ 

26 raise NotImplementedError 

27 

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

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

30 

31 Args: 

32 uuid: A unique id of a user invitation. 

33 

34 Returns: 

35 The active query 

36 """ 

37 raise NotImplementedError 

38 

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

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

41 

42 Args: 

43 email: An email address. 

44 

45 Returns: 

46 The active query 

47 """ 

48 raise NotImplementedError 

49 

50 def filter_active(self, timestamp: Timestamp) -> "UserInvitationQuery": 

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

52 

53 Returns: 

54 The active query 

55 """ 

56 raise NotImplementedError