2022-11-19 20:43:05 +01:00
|
|
|
from marshmallow import Schema, fields, validate
|
2022-10-26 12:41:22 +02:00
|
|
|
|
|
|
|
from ..validators import validate_index
|
2023-01-14 01:37:31 +01:00
|
|
|
from .students import GroupSchema
|
2022-10-26 12:41:22 +02:00
|
|
|
|
|
|
|
|
2022-11-19 20:43:05 +01:00
|
|
|
class GroupQuerySchema(Schema):
|
2022-10-26 12:41:22 +02:00
|
|
|
name = fields.Str()
|
|
|
|
page = fields.Integer()
|
|
|
|
per_page = fields.Integer()
|
|
|
|
|
|
|
|
|
2022-11-19 20:43:05 +01:00
|
|
|
class GroupsPaginationSchema(Schema):
|
2022-10-26 12:41:22 +02:00
|
|
|
groups = fields.List(fields.Nested(GroupSchema))
|
|
|
|
max_pages = fields.Integer()
|
|
|
|
|
|
|
|
|
2022-11-19 20:43:05 +01:00
|
|
|
class GroupCreateSchema(Schema):
|
2022-10-26 12:41:22 +02:00
|
|
|
name = fields.Str(validate=validate.Length(min=1, max=255), required=True)
|
|
|
|
project_supervisor_id = fields.Integer(required=True)
|
2023-01-14 01:37:31 +01:00
|
|
|
students = fields.List(fields.Integer(required=True))
|
2022-10-26 12:41:22 +02:00
|
|
|
|
|
|
|
|
2022-11-19 20:43:05 +01:00
|
|
|
class GroupEditSchema(Schema):
|
2022-10-26 12:41:22 +02:00
|
|
|
name = fields.Str(validate=validate.Length(min=1, max=255))
|
2023-01-06 19:24:02 +01:00
|
|
|
project_supervisor_id = fields.Integer()
|
2023-01-14 01:37:31 +01:00
|
|
|
students = fields.List(fields.Integer())
|
2022-11-19 20:43:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
class GroupIdSchema(Schema):
|
|
|
|
group_id = fields.Integer(required=True)
|