Coverage for bc/kwai-bc-identity/src/kwai_bc_identity/user_recoveries/user_recovery_repository.py: 100%
5 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 recovery repository."""
3from abc import abstractmethod
5from kwai_core.domain.value_objects.unique_id import UniqueId
7from kwai_bc_identity.user_recoveries.user_recovery import UserRecoveryEntity
10class UserRecoveryRepository:
11 """Interface for a user recovery repository."""
13 @abstractmethod
14 async def get_by_uuid(self, uuid: UniqueId) -> UserRecoveryEntity:
15 """Get a user recovery with the given unique id."""
16 raise NotImplementedError
18 @abstractmethod
19 async def create(self, user_recovery: UserRecoveryEntity) -> UserRecoveryEntity:
20 """Save a new user recovery."""
21 raise NotImplementedError
23 @abstractmethod
24 async def update(self, user_recovery: UserRecoveryEntity):
25 """Save a user recovery."""
26 raise NotImplementedError
28 @abstractmethod
29 async def delete(self, user_recovery: UserRecoveryEntity):
30 """Deletes a user recovery."""
31 raise NotImplementedError
34class UserRecoveryNotFoundException(Exception):
35 """Raised when the user recovery could not be found."""