Coverage for kwai/modules/identity/user_recoveries/user_recovery_repository.py: 100%

5 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 recovery repository.""" 

2from abc import abstractmethod 

3 

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

5from kwai.modules.identity.user_recoveries.user_recovery import UserRecoveryEntity 

6 

7 

8class UserRecoveryRepository: 

9 """Interface for a user recovery repository.""" 

10 

11 @abstractmethod 

12 async def get_by_uuid(self, uuid: UniqueId) -> UserRecoveryEntity: 

13 """Get a user recovery with the given unique id.""" 

14 raise NotImplementedError 

15 

16 @abstractmethod 

17 async def create(self, user_recovery: UserRecoveryEntity) -> UserRecoveryEntity: 

18 """Save a new user recovery.""" 

19 raise NotImplementedError 

20 

21 @abstractmethod 

22 async def update(self, user_recovery: UserRecoveryEntity): 

23 """Save a user recovery.""" 

24 raise NotImplementedError 

25 

26 @abstractmethod 

27 async def delete(self, user_recovery: UserRecoveryEntity): 

28 """Deletes a user recovery.""" 

29 raise NotImplementedError 

30 

31 

32class UserRecoveryNotFoundException(Exception): 

33 """Raised when the user recovery could not be found."""