Coverage for bc/kwai-bc-club/src/kwai_bc_club/domain/club_coach.py: 95%

20 statements  

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

1"""Module for defining a coach entity.""" 

2 

3from dataclasses import dataclass 

4from typing import ClassVar, Type 

5 

6from kwai_core.domain.entity import DataclassEntity 

7from kwai_core.domain.value_objects.identifier import IntIdentifier 

8from kwai_core.domain.value_objects.name import Name 

9 

10from kwai_bc_club.domain.member import MemberEntity 

11 

12 

13class ClubCoachIdentifier(IntIdentifier): 

14 """Identifier for a club coach.""" 

15 

16 

17@dataclass(kw_only=True, eq=False, slots=True, frozen=True) 

18class ClubCoachEntity(DataclassEntity): 

19 """A club coach entity. 

20 

21 Attributes: 

22 member: A coach is a member of the club. 

23 description: The description (bio) of the coach. 

24 diploma: The diploma of the coach. 

25 active: Whether the coach is active. 

26 remark: A remark about the coach. 

27 traceable_time: The creation and modification timestamp of the coach. 

28 """ 

29 

30 ID: ClassVar[Type] = ClubCoachIdentifier 

31 

32 member: MemberEntity 

33 description: str = "" 

34 diploma: str = "" 

35 active: bool = True 

36 remark: str = "" 

37 

38 @property 

39 def name(self) -> Name: 

40 """Return the name of the coach.""" 

41 return self.member.person.name 

42 

43 @property 

44 def uuid(self): 

45 """Return the uuid of the coach.""" 

46 return self.member.uuid