Example #1
0
class ClientTemplateSchema(ma.Schema):
    sessions = ma.Nested(PartialClientSessionSchema, many=True)
    user = ma.Nested(PartialUserSchema, many=False)

    class Meta:
        fields = ('id', 'name', 'slug', 'start_date', 'end_date', 'user_id',
                  'completed', 'sessions', 'user', 'active')
Example #2
0
class ClientSessionSchema(ma.Schema):
    exercises = ma.Nested(ClientExerciseSchema, many=True)
    training_entries = ma.Nested(TrainingEntrySchema, many=True)

    class Meta:
        fields = ('id', 'client_weight', 'comment', 'name', 'slug', 'order',
                  'completed', 'client_template_id', 'exercises',
                  'training_entries', 'completed_date')
Example #3
0
class ReaderSchema(ma.SQLAlchemyAutoSchema):
    class Meta:
        model = Reader
        include_relationships = True
        exclude = ("password", )

    collections = ma.Nested(CollectionSchema, many=True, only=["id", "name"])
    followers = ma.Nested(SimpleReader, many=True)
    follows = ma.Nested(SimpleReader, many=True)
    roles = ma.Function(lambda user: user.roles.split(","))
Example #4
0
class CollectionSchema(ma.SQLAlchemyAutoSchema):
    class Meta:
        model = Collection
        include_relationships = True
        exclude = ("book_memberships", )

    books = ma.Nested(BookSchema, many=True)
Example #5
0
class CardSchema(ma.ModelSchema):
    id = fields.Int(required=True)
    activity_id = fields.Int(required=True)
    github_raw_data = fields.Str(required=True)
    content = fields.Str(required=True)
    gems = fields.Int(required=True)
    name = fields.Str(required=True)
    # activity is used to keep track of which activity that the card belongs to
    concepts = ma.Nested("ConceptSchema", only=("id", ), many=True)
    hints = ma.Nested("HintSchema", only=("id", "hints"), many=True)
    checkpoint = ma.Nested("CheckpointSchema", only=("id", ))

    class Meta:
        # Fields to show when sending data
        fields = ("id", "activity_id", "content", "gems", "name", "concepts",
                  "hints", "checkpoint")
        ordered = True
Example #6
0
class TopicSchema(ma.ModelSchema):
    id = fields.Int(required=True)
    name = fields.Str(required=True)
    description = fields.Str(required=True)
    image = fields.Str(required=True)
    modules = ma.Nested("ModuleSchema", only=("id", "name"), many=True)

    class Meta:
        # Fields to show when sending data
        fields = ("id", "name", "description", "modules")
        ordered = True
Example #7
0
class ModuleSchema(ma.Schema):
    id = fields.Int(required=True)
    name = fields.Str(required=True)
    description = fields.Str(required=True)
    gems_needed = fields.Int(required=True)
    image = fields.Str(required=True)
    activities = ma.Nested("ActivitySchema",
                           only=("id", "is_project"),
                           many=True)

    class Meta:
        # Fields to show when sending data
        fields = ("id", "name", "description", "gems_needed", "image",
                  "activities")
        ordered = True
Example #8
0
class ReviewSchema(ma.SQLAlchemyAutoSchema):
    class Meta:
        model = Review
        include_relationships = True

    reader = ma.Nested(SimpleReader)
Example #9
0
class GenreSchema(ma.SQLAlchemyAutoSchema):
    class Meta:
        model = Genre
        include_relationships = True

    books = ma.Nested(BookSchema, many=True)
Example #10
0
class TrainingLogSchema(ma.Schema):
    training_entries = ma.Nested(TrainingEntrySchema, many=True)

    class Meta:
        fields = ('id', 'name', 'order', 'slug', 'completed', 'completed_date',
                  'training_entries')
Example #11
0
class CoachTemplateSchema(ma.Schema):
    sessions = ma.Nested(PartialCoachSessionSchema, many=True)
    class Meta:
        fields = ('id', 'name', 'sessions', 'slug')
Example #12
0
class CoachSessionSchema(ma.Schema):
    coach_exercises = ma.Nested(CoachExerciseSchema, many=True)
    class Meta:
        fields = ('id', 'name', 'slug', 'order', 'coach_template_id', 'coach_exercises')