def retrieve(self, equipment_id):
     with read_replica_async_session() as session:
         goal = session.query(EquipmentModel).filter_by(id=equipment_id).first()
         schema = EquipmentOutputSchema()
         schema.equipment_id = goal.id
         schema.description = goal.description
         return schema.to_primitive()
 def list(self, args=None, kwargs=None):
     with read_replica_async_session() as session:
         results = []
         for goal in session.query(EquipmentModel).all():
             schema = EquipmentOutputSchema()
             schema.equipment_id = goal.id
             schema.description = goal.description
             results.append(schema.to_primitive())
     return results
Example #3
0
    def retrieve(self, muscle_group_id):
        with read_replica_async_session() as session:
            muscle_group = session.query(MuscleGroupModel).filter_by(
                id=muscle_group_id).first()
            output = MuscleGroupOutputSchema()
            output.id = muscle_group.id
            output.name = muscle_group.name

            output.validate()
            return output.to_primitive()
Example #4
0
    def list(self, args=None, kwargs=None):
        with read_replica_async_session() as session:
            results = []
            for muscle_group in session.query(MuscleGroupModel).all():
                output = MuscleGroupOutputSchema()
                output.muscle_group_id = muscle_group.id
                output.name = muscle_group.name

                output.validate()
                results.append(output.to_primitive())
        return results
Example #5
0
 def retrieve(self, exercise_id):
     with read_replica_async_session() as session:
         exercise = session.query(ExerciseModel).filter_by(
             id=exercise_id).first()
         output = ExerciseOutputSchema()
         output.exercise_id = exercise.id
         output.name = exercise.name
         output.description = exercise.description
         output.video_url = exercise.video_url
         output.files = []
         for file in exercise.files:
             output_file = ExerciseFileOutputSchema()
             output_file.id = file.id
             output_file.exercise_id = file.exercise_id
             output_file.file_id = file.file_id
             output.files.append(output_file)
         return output.to_primitive()
Example #6
0
    def list(self, args=None, kwargs=None):
        with read_replica_async_session() as session:
            results = []
            for exercise in session.query(ExerciseModel).all():
                output = ExerciseOutputSchema()
                output.exercise_id = exercise.id
                output.name = exercise.name
                output.description = exercise.description
                output.video_url = exercise.video_url
                output.files = []
                for file in exercise.files:
                    output_file = ExerciseFileOutputSchema()
                    output_file.id = file.id
                    output_file.exercise_id = file.exercise_id
                    output_file.file_id = file.file_id
                    output.files.append(output_file)

                results.append(output.to_primitive())
        return results