Coverage for src/kwai/modules/club/repositories/contact_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 contact repository.""" 

2 

3from abc import ABC, abstractmethod 

4 

5from kwai.modules.club.domain.contact import ContactEntity, ContactIdentifier 

6 

7 

8class ContactNotFoundException(Exception): 

9 """Raised when the contact cannot be found.""" 

10 

11 

12class ContactRepository(ABC): 

13 """Interface for a contact repository.""" 

14 

15 @abstractmethod 

16 async def create(self, contact: ContactEntity) -> ContactEntity: 

17 """Save a contact entity.""" 

18 

19 @abstractmethod 

20 async def delete(self, contact: ContactEntity): 

21 """Delete a contact entity.""" 

22 

23 @abstractmethod 

24 async def update(self, contact: ContactEntity): 

25 """Update a contact entity.""" 

26 

27 @abstractmethod 

28 async def get(self, id_: ContactIdentifier) -> ContactEntity: 

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