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
« 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."""
3from abc import ABC, abstractmethod
5from kwai.modules.club.domain.contact import ContactEntity, ContactIdentifier
8class ContactNotFoundException(Exception):
9 """Raised when the contact cannot be found."""
12class ContactRepository(ABC):
13 """Interface for a contact repository."""
15 @abstractmethod
16 async def create(self, contact: ContactEntity) -> ContactEntity:
17 """Save a contact entity."""
19 @abstractmethod
20 async def delete(self, contact: ContactEntity):
21 """Delete a contact entity."""
23 @abstractmethod
24 async def update(self, contact: ContactEntity):
25 """Update a contact entity."""
27 @abstractmethod
28 async def get(self, id_: ContactIdentifier) -> ContactEntity:
29 """Get the contact for the given id."""