system-pri/backend/app/coordinator/schemas/project_supervisor.py

39 lines
1.3 KiB
Python
Raw Permalink Normal View History

from marshmallow import Schema, fields, validate
class ProjectSupervisorSchema(Schema):
id = fields.Integer()
first_name = fields.Str()
last_name = fields.Str()
email = fields.Str()
limit_group = fields.Integer()
class ProjectSupervisorQuerySchema(Schema):
fullname = fields.Str()
order_by_first_name = fields.Str()
order_by_last_name = fields.Str()
page = fields.Integer()
per_page = fields.Integer()
class ProjectSupervisorsPaginationSchema(Schema):
project_supervisors = fields.List(fields.Nested(ProjectSupervisorSchema))
max_pages = fields.Integer()
class ProjectSupervisorCreateSchema(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), validate.Email()], required=True
)
limit_group = fields.Integer(required=True)
class ProjectSupervisorEditSchema(Schema):
first_name = fields.Str(validate=validate.Length(min=1, max=255))
last_name = fields.Str(validate=validate.Length(min=1, max=255))
email = fields.Str(validate=[validate.Length(min=0, max=255), validate.Email()])
limit_group = fields.Integer()