class StandingSchema(SQLAlchemyAutoSchema): team = fields.Nested(TeamSchema) stage = fields.Nested(StageSchema) class Meta: model = Standing include_fk = True
class ComSchema(ma.SQLAlchemyAutoSchema): class Meta: model = Commentaire sqla_session = db.session user = fields.Nested('ComUserSchema', default=None) sortie = fields.Nested('ComSortieSchema', default=None)
class TaskSchema(ma.SQLAlchemyAutoSchema): class Meta: model = Task load_instance = True include_fk = True user = fields.Nested(UserSchema()) project = fields.Nested(ProjectSchema())
class MessageSchema(SQLAlchemyAutoSchema): sender = fields.Nested(UserSchema) receiver = fields.Nested(UserSchema) created_at = marshmallow_fields.String(data_key="createdAt") class Meta: fields = ("id", "subject", "message", "created_at", "sender", "receiver")
class ProjectSchema(ma.SQLAlchemyAutoSchema): class Meta: model = Project load_instance = True include_fk = True user = fields.Nested(UserSchema()) project_team = fields.Nested(TeamSchema(), many=True)
class SortieSchema(ma.SQLAlchemyAutoSchema): class Meta: model = Sortie sqla_session = db.session load_instance = True commentaires = fields.Nested('SortieComSchema', default=[], many=True) participants = fields.Nested('SortieUserSchema', default=[], many=True)
class ArticlePutPostSchema(ArticleSchema): """ Schema for put/post methods for Article Model """ tags = sqlalchemy_fields.Nested(TagSchema, many=True, only=["id"]) categories = sqlalchemy_fields.Nested(CategorySchema, many=True, only=["id"])
class UserSchema(ma.SQLAlchemyAutoSchema): class Meta: model = User sqla_session = db.session load_instance = True commentaires = fields.Nested('UserComSchema', default=[], many=True) sorties_a_venir = fields.Nested('UserSortieSchema', default=[], many=True) sorties_finies = fields.Nested('UserSortieSchema', default=[], many=True)
class FullUserSchema(UserSchema): active_pairing_sessions = fields.Nested(PairingSessionSchema, many=True) team = fields.Nested(TeamSchema) feedback_received = fields.Nested(FeedbackSchema, many=True) feedback_tag_groups = fields.Nested(FeedbackTagGroupSchema, many=True) class Meta: fields = ('id', 'active_pairing_sessions', 'team', 'username', 'full_name', 'uuid', 'feedback_received', 'feedback_tag_groups')
class MatchSchema(SQLAlchemyAutoSchema): homeTeam = fields.Nested(TeamSchema) awayTeam = fields.Nested(TeamSchema) tournament = fields.Nested(TournamentSchema) stage = fields.Nested(StageSchema) goals = fields.Nested(GoalSchema, many=True) class Meta: model = Match include_fk = True
class AssertionSchema(ma.Schema): class Meta: fields = ("assertion_id", "disease", "context", "oncotree_term", "oncotree_code", "therapy_name", "therapy_strategy", "therapy_type", "therapy_sensitivity", "therapy_resistance", "favorable_prognosis", "predictive_implication", "description", "last_updated", "sources", "features") sources = fields.Nested(SourceSchema, many=True, exclude=("assertions", )) features = fields.Nested(FeatureSchema, many=True)
class FeatureSchema(ma.Schema): class Meta: fields = ("attributes", "feature_definition", "feature_id") feature_definition = fields.Nested(FeatureDefinitionSchema, only=( "name", "attribute_definitions", )) attributes = fields.Nested(FeatureAttributeSchema, many=True, only=("value", ))
class UserSchema(SQLAlchemySchema): id = auto_field() name = auto_field() uid = auto_field() is_admin = auto_field() class Meta: model = User load_instance = True include_relationships = True values = fields.Nested(UserFieldValueSchema, many=True) group = fields.Nested(UserGroupSchema, many=False)
class ArticleSchema(ModelSchema): """ ArticleModel BaseSchema """ id = fields.Int(dump_only=True) tags = sqlalchemy_fields.Nested(TagSchema, many=True) categories = sqlalchemy_fields.Nested(CategorySchema, many=True) class Meta: """ MetaClass for Article Schema """ model = ArticleModel
class NotificationSchema(ma.SQLAlchemyAutoSchema): class Meta: model = Notification load_instance = True include_fk = True user = fields.Nested(UserSchema())
class FeedbackTagGroupSchema(SQLAlchemyAutoSchema): class Meta: model = PairingSession include_relationships = True fields = ('id', 'name', 'tags') tags = fields.Nested(FeedbackTagSchema, many=True)
class TeamSchema(ma.SQLAlchemyAutoSchema): class Meta: model = Team load_instance = True include_fk = True users = fields.Nested(UserSchema(), many=True)
class TicketSchema(ma.SQLAlchemyAutoSchema): class Meta: model = Ticket load_instance = True include_fk = True comments = fields.Nested('TicketCommentSchema', many=True)
class VillageSchema(SQLAlchemyAutoSchema): class Meta: model = Village include_relationships = True load_instance = True ninjas = fields.Nested(NinjaSchema())
class CommentSchema(SQLAlchemyAutoSchema): class Meta: model = Comment text = auto_field( validate=validate.Length(min=1, max=Comment.max_text_length)) user = fields.Nested(UserSchema, exclude=("email", "polls"))
class ConfigurationSchema(SQLAlchemyAutoSchema): detections = fields.Nested(DetectionTypesSchema, many=True) class Meta: model = Configuration include_relationships = True load_instance = True
class UserSchema(SQLAlchemyAutoSchema): class Meta: model = User fields = ('username', 'role', 'uuid', 'created_at', 'id', 'deleted', 'full_name') role = fields.Nested(RoleSchema)
class ProductSchema(SQLAlchemyAutoSchema): category = fields.Nested(CategorySchema, data_key="category") class Meta: model = Product load_instance = True sqla_session = db.session include_fk = True
class PairingSessionSchema(SQLAlchemyAutoSchema): class Meta: model = PairingSession include_relationships = True fields = ('info', 'streak', 'users', 'uuid', 'id', 'created_at') users = fields.Nested(UserSchema, many=True)
class KYCSchema(ma.SQLAlchemyAutoSchema): class Meta: model = Kyc load_instance = True include_fk = True user = fields.Nested(UserSchema())
class UserSchema(ma.SQLAlchemyAutoSchema): class Meta: model = User load_instance = True exclude = ['password', 'uuid'] include_fk = True tags = fields.Nested(TagSchema(), many=True)
class SectorSchema(ModelSchema): class Meta: model = Sector include_relationships = True include_fk = True load_instance = True children = fields.Nested('self', many=True)
class FeedSchema(SQLAlchemyAutoSchema): feed_type = EnumField(CamType, by_value=True) configuration = fields.Nested(ConfigurationSchema) class Meta: model = Feed include_relationships = True load_instance = True
class ReferralSchema(ma.SQLAlchemyAutoSchema): followUp = fields.Nested(FollowUpSchema) class Meta: include_fk = True model = Referral load_instance = True include_relationships = True
class FeatureDefinitionSchema(ma.Schema): class Meta: fields = ("attribute_definitions", "feature_def_id", "features", "name", "readable_name") attribute_definitions = fields.Nested(FeatureAttributeDefinitionSchema, many=True, only=("name", ))