Coverage for src/kwai/modules/identity/user_recoveries/user_recovery_repository.py: 100%
5 statements
« prev ^ index » next coverage.py v7.6.10, created at 2024-01-01 00:00 +0000
« 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 recovery repository."""
3from abc import abstractmethod
5from kwai.core.domain.value_objects.unique_id import UniqueId
6from kwai.modules.identity.user_recoveries.user_recovery import UserRecoveryEntity
9class UserRecoveryRepository:
10 """Interface for a user recovery repository."""
12 @abstractmethod
13 async def get_by_uuid(self, uuid: UniqueId) -> UserRecoveryEntity:
14 """Get a user recovery with the given unique id."""
15 raise NotImplementedError
17 @abstractmethod
18 async def create(self, user_recovery: UserRecoveryEntity) -> UserRecoveryEntity:
19 """Save a new user recovery."""
20 raise NotImplementedError
22 @abstractmethod
23 async def update(self, user_recovery: UserRecoveryEntity):
24 """Save a user recovery."""
25 raise NotImplementedError
27 @abstractmethod
28 async def delete(self, user_recovery: UserRecoveryEntity):
29 """Deletes a user recovery."""
30 raise NotImplementedError
33class UserRecoveryNotFoundException(Exception):
34 """Raised when the user recovery could not be found."""