Coverage for bc/kwai-bc-training/src/kwai_bc_training/trainings/value_objects.py: 100%
16 statements
« prev ^ index » next coverage.py v7.11.0, created at 2024-01-01 00:00 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2024-01-01 00:00 +0000
1"""Module that defines a value objects for the bounded context trainings."""
3from dataclasses import dataclass
5from kwai_core.domain.value_objects.identifier import IntIdentifier
6from kwai_core.domain.value_objects.owner import Owner
7from kwai_core.domain.value_objects.traceable_time import TraceableTime
9from kwai_bc_training.coaches.coach import CoachEntity
12@dataclass(kw_only=True, frozen=True, slots=True)
13class Season:
14 """A season.
16 Attributes:
17 id: The id of the season.
18 name: The name of the season.
19 """
21 id: IntIdentifier
22 name: str
25@dataclass(kw_only=True, frozen=True, slots=True)
26class TrainingCoach:
27 """A coach attached to a training."""
29 coach: CoachEntity
30 owner: Owner
31 present: bool = False
32 type: int = 0
33 payed: bool = False
34 remark: str = ""
35 traceable_time: TraceableTime = TraceableTime()
37 def __hash__(self) -> int:
38 """Use the coach entity to create the hash."""
39 return hash(self.coach)