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

36 lines
943 B
Python
Raw Normal View History

from marshmallow import Schema, fields, validate
from .students import GroupSchema
class GroupQuerySchema(Schema):
name = fields.Str()
page = fields.Integer()
per_page = fields.Integer()
class GroupsPaginationSchema(Schema):
groups = fields.List(fields.Nested(GroupSchema))
max_pages = fields.Integer()
class GroupCreateSchema(Schema):
name = fields.Str(validate=validate.Length(min=1, max=255), required=True)
project_supervisor_id = fields.Integer(required=True)
students = fields.List(fields.Integer(required=True))
class GroupEditSchema(Schema):
name = fields.Str(validate=validate.Length(min=1, max=255))
project_supervisor_id = fields.Integer()
students = fields.List(fields.Integer())
class GroupIdSchema(Schema):
group_id = fields.Integer(required=True)
class GroupSetGradeSchema(Schema):
grade_for_first_term = fields.Float()
grade_for_second_term = fields.Float()