Coverage for src/kwai/modules/club/repositories/country_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 the country repository.""" 

2 

3from abc import ABC, abstractmethod 

4 

5from kwai.modules.club.domain.country import CountryEntity 

6 

7 

8class CountryNotFoundException(Exception): 

9 """Raised when the country is not found.""" 

10 

11 

12class CountryRepository(ABC): 

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

14 

15 @abstractmethod 

16 async def get_by_iso_2(self, iso_2: str) -> CountryEntity: 

17 """Get a country using the iso2 code of the country.""" 

18 

19 @abstractmethod 

20 async def create(self, country: CountryEntity): 

21 """Save a country in the repository.""" 

22 

23 @abstractmethod 

24 async def delete(self, country: CountryEntity): 

25 """Delete a country from the repository."""