Coverage for src/kwai/modules/club/repositories/person_repository.py: 100%

4 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 person repository.""" 

2 

3from abc import ABC, abstractmethod 

4 

5from kwai.modules.club.domain.person import PersonEntity, PersonIdentifier 

6 

7 

8class PersonNotFoundException(Exception): 

9 """Raised when a person cannot be found.""" 

10 

11 

12class PersonRepository(ABC): 

13 """An interface for a person repository.""" 

14 

15 @abstractmethod 

16 async def create(self, person: PersonEntity) -> PersonEntity: 

17 """Save a person entity.""" 

18 

19 @abstractmethod 

20 async def update(self, person: PersonEntity) -> None: 

21 """Update a person entity.""" 

22 

23 @abstractmethod 

24 async def delete(self, person: PersonEntity): 

25 """Delete a person entity.""" 

26 

27 @abstractmethod 

28 async def get(self, id_: PersonIdentifier) -> PersonEntity: 

29 """Get the person for the given id."""