from marshmallow import fields, validate from ...dependencies import ma from ..validators import validate_index from .students import ProjectSupervisorSchema class ProjectSupervisorQuerySchema(ma.Schema): fullname = fields.Str() order_by_first_name = fields.Str() order_by_last_name = fields.Str() page = fields.Integer() per_page = fields.Integer() mode = fields.Integer() class ProjectSupervisorsPaginationSchema(ma.Schema): project_supervisors = fields.List(fields.Nested(ProjectSupervisorSchema)) max_pages = fields.Integer() class ProjectSupervisorCreateSchema(ma.Schema): first_name = fields.Str(validate=validate.Length(min=1, max=255), required=True) last_name = fields.Str(validate=validate.Length(min=1, max=255), required=True) email = fields.Str(validate=validate.Length(min=1, max=255), required=True) limit_group = fields.Integer() mode = fields.Integer(required=True) class ProjectSupervisorEditSchema(ma.Schema): first_name = fields.Str(validate=validate.Length(min=1, max=255), required=True) last_name = fields.Str(validate=validate.Length(min=1, max=255), required=True) email = fields.Str(validate=validate.Length(min=0, max=11), required=True) limit_group = fields.Integer(validate=validate_index) count_groups = fields.Integer(validate=validate_index) mode = fields.Integer(required=True)