class SubscriptionWatchSchema(ma.SQLAlchemyAutoSchema): class Meta: model = models.Watched exclude = ['ModifiedDate', 'ModifiedBy', 'CreatedDate', 'CreatedBy'] episode = ma.Nested(EpisodesSchema) show = ma.Nested(ShowSchema)
class SubscriptionSchema(ma.SQLAlchemyAutoSchema): watched = ma.Boolean(dump_only=True) class Meta: model = models.Subscription exclude = ['ModifiedDate', 'ModifiedBy', 'CreatedDate', 'CreatedBy'] show = ma.Nested(ShowSchema)
class SeasonWatchSchema(ma.SQLAlchemyAutoSchema): watched = ma.Boolean(dump_only=True) class Meta: model = models.SeasonWatched exclude = ['ModifiedDate', 'ModifiedBy', 'CreatedDate', 'CreatedBy'] season = ma.Nested(SeasonSchema)
class BuildingSchema(ma.Schema): """ JSON schema for a building """ class Meta: # JSON fields - type will be inferred # TODO: not exposing 'app_id', however this is in the database fields = ('b_id', 'name', 'address', 'address2', 'zipcode', 'image_url', 'website_url', 'latitude', 'longitude', 'shape_coordinates', 'phone_num', 'tags', 'categories') # 'address2' field maps to the DB model attribute 'city', which must explicitly defined w/ attribute mapping address2 = ma.String(attribute='city') # include lists of only the tag and category names tags = ma.Nested(TagSchema, only='tag_name', many=True) categories = ma.Nested(CategorySchema, only='cat_name', many=True)
class SubscribedChannelSchema(CamelCaseSchema): watched = ma.Integer(dump_only=True) unwatched = ma.Integer(dump_only=True) class Meta: model = models.SubscribedChannel exclude = ['ModifiedDate', 'ModifiedBy', 'CreatedDate', 'CreatedBy'] channel = ma.Nested(ChannelSchema)
class SubscribedVideoSchema(CamelCaseSchema): class Meta: model = models.SubscribedVideo exclude = ['ModifiedDate', 'ModifiedBy', 'CreatedDate', 'CreatedBy'] video = ma.Nested(VideoSchema)
class UserBookSchema(CamelCaseSchema): class Meta: model = models.UserBook exclude = ['ModifiedDate', 'ModifiedBy', 'CreatedDate', 'CreatedBy'] book = ma.Nested(BookSchema)
class UserMovieGroupSchema(ma.SQLAlchemyAutoSchema): class Meta: model = models.AddedMovieGroup movie_group = ma.Nested(MovieGroupSchema, exclude=('movies', )) movies = ma.Nested(UserMovieSchema, many=True)
class MovieGroupSchema(ma.SQLAlchemyAutoSchema): class Meta: model = models.MovieGroup exclude = ['ModifiedDate', 'ModifiedBy', 'CreatedDate', 'CreatedBy'] movies = ma.Nested(MovieSchema, many=True)
class UserMovieSchema(ma.SQLAlchemyAutoSchema): class Meta: model = models.AddedMovie exclude = ['ModifiedDate', 'ModifiedBy', 'CreatedDate', 'CreatedBy'] movie = ma.Nested(MovieSchema)