예제 #1
0
from project.common import gym_dataclass

Subscription = gym_dataclass(
    {
        'date': str,
        'customer_id': int,
        'trainer_id': int,
        'exercise_id': int,
    }, 'Subscription <{self.id}> on {self.date}')
예제 #2
0
from project.common import gym_dataclass

Equipment = gym_dataclass({
    'name': str,
}, 'Equipment <{self.id}> {self.name}')
예제 #3
0
from project.common import gym_dataclass

Trainer = gym_dataclass({
    'name': str,
}, 'Trainer <{self.id}> {self.name}')
예제 #4
0
from project.common import gym_dataclass

Customer = gym_dataclass({
    'name': str,
    'address': str,
    'email': str
}, 'Customer <{self.id}> {self.name}; Address: {self.address}; Email: {self.email}'
                         )
예제 #5
0
from project.common import gym_dataclass


@classmethod
def from_hours(cls, trainer_id: int, equipment_id: int, hours: int):
    return cls(trainer_id, equipment_id, hours * 60)


ExercisePlan = gym_dataclass(
    {
        'trainer_id': int,
        'equipment_id': int,
        'duration': int,
    }, 'Plan <{self.id}> with duration {self.duration} minutes')

ExercisePlan.from_hours = from_hours