Coverage for bc/kwai-bc-identity/src/kwai_bc_identity/user_invitations/user_invitation_query.py: 100%
13 statements
« prev ^ index » next coverage.py v7.11.0, created at 2024-01-01 00:00 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2024-01-01 00:00 +0000
1"""Module that defines an interface for a user invitation query."""
3from abc import ABC
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
10from kwai_bc_identity.user_invitations.user_invitation import (
11 UserInvitationIdentifier,
12)
15class UserInvitationQuery(Query, ABC):
16 """An interface for querying user invitations."""
18 def filter_by_id(self, id_: UserInvitationIdentifier) -> "UserInvitationQuery":
19 """Add a filter on the user invitation for id.
21 Args:
22 id_: An id of a user invitation.
24 Returns:
25 The active query
26 """
27 raise NotImplementedError
29 def filter_by_uuid(self, uuid: UniqueId) -> "UserInvitationQuery":
30 """Add a filter on the user invitation for the unique id.
32 Args:
33 uuid: A unique id of a user invitation.
35 Returns:
36 The active query
37 """
38 raise NotImplementedError
40 def filter_by_email(self, email: EmailAddress) -> "UserInvitationQuery":
41 """Add a filter on the user invitation for the email address.
43 Args:
44 email: An email address.
46 Returns:
47 The active query
48 """
49 raise NotImplementedError
51 def filter_active(self) -> "UserInvitationQuery":
52 """Add a filter to only return the active invitations at the given time.
54 Returns:
55 The active query
56 """
57 raise NotImplementedError
59 def filter_not_expired(self, timestamp: Timestamp) -> "UserInvitationQuery":
60 """Add a filter to only return not expired invitations.
62 Returns:
63 The active query.
64 """
65 raise NotImplementedError
67 def filter_not_confirmed(self) -> "UserInvitationQuery":
68 """Add a filter to only return not confirmed invitations.
70 Returns:
71 The active query.
72 """
73 raise NotImplementedError