Coverage for bc/kwai-bc-club/src/kwai_bc_club/repositories/member_query.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2024-01-01 00:00 +0000

1"""Module that defines an interface for a Member query.""" 

2 

3from abc import ABC, abstractmethod 

4from typing import Self 

5 

6from kwai_core.domain.repository.query import Query 

7from kwai_core.domain.value_objects.unique_id import UniqueId 

8 

9from kwai_bc_club.domain.member import MemberIdentifier 

10 

11 

12class MemberQuery(Query, ABC): 

13 """An interface for a member query.""" 

14 

15 @abstractmethod 

16 def filter_by_id(self, id_: MemberIdentifier) -> Self: 

17 """Filter on the license of the member.""" 

18 

19 @abstractmethod 

20 def filter_by_license(self, license: str) -> Self: 

21 """Filter on the license of the member.""" 

22 

23 @abstractmethod 

24 def filter_by_license_date( 

25 self, license_end_month: int, license_end_year: int 

26 ) -> Self: 

27 """Filter on the license expiration date.""" 

28 

29 @abstractmethod 

30 def filter_by_active(self) -> Self: 

31 """Filter on the active members.""" 

32 

33 @abstractmethod 

34 def filter_like_name(self, name: str) -> Self: 

35 """Filter on the name of a member.""" 

36 

37 @abstractmethod 

38 def filter_by_uuid(self, uuid: UniqueId) -> Self: 

39 """Filter on the uuid.""" 

40 

41 @abstractmethod 

42 def filter_is_coach(self) -> Self: 

43 """Filter on members that are coach.""" 

44 

45 @abstractmethod 

46 def filter_is_not_coach(self) -> Self: 

47 """Filter on members that are not coach."""