Coverage for bc/kwai-bc-training/src/kwai_bc_training/trainings/training_schedule.py: 100%
18 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 for defining a training schedule entity."""
3from dataclasses import dataclass, field
4from typing import ClassVar, Type
6from kwai_core.domain.entity import DataclassEntity
7from kwai_core.domain.value_objects.identifier import IntIdentifier
8from kwai_core.domain.value_objects.owner import Owner
9from kwai_core.domain.value_objects.time_period import TimePeriod
10from kwai_core.domain.value_objects.weekday import Weekday
12from kwai_bc_training.coaches.coach import CoachEntity
13from kwai_bc_training.teams.team import TeamEntity
16class TrainingScheduleIdentifier(IntIdentifier):
17 """Identifier for a training schedule."""
20@dataclass(kw_only=True, eq=False, slots=True, frozen=True)
21class TrainingScheduleEntity(DataclassEntity):
22 """A training schedule entity.
24 A training schedule can be used to create recurring trainings.
26 Attributes:
27 name: The name of the training schedule.
28 description: A description of the training schedule.
29 weekday: The weekday to use to create the recurring trainings.
30 period: The time period to use to create the recurring trainings.
31 active: Is this schedule active?
32 location: The location of the recurring trainings.
33 remark: A remark about this training schedule.
34 team: A team that is associated with the schedule.
35 owner: The owner of this training schedule.
36 coaches: Coaches linked to this training schedule.
37 """
39 ID: ClassVar[Type] = TrainingScheduleIdentifier
41 name: str
42 description: str
43 weekday: Weekday
44 period: TimePeriod
45 active: bool = True
46 location: str = ""
47 remark: str = ""
48 team: TeamEntity | None = None
49 owner: Owner
50 coaches: frozenset[CoachEntity] = field(default_factory=frozenset)