2022-11-16 20:42:40 +01:00
|
|
|
from marshmallow import Schema, fields, validate
|
2022-10-26 15:11:50 +02:00
|
|
|
|
|
|
|
from ..validators import validate_datetime_greater_than_now
|
|
|
|
|
|
|
|
|
2022-11-16 20:42:40 +01:00
|
|
|
class TermOfDefenceSchema(Schema):
|
2023-01-14 17:38:03 +01:00
|
|
|
start_date = fields.DateTime(
|
|
|
|
validate=validate_datetime_greater_than_now, required=True
|
|
|
|
)
|
|
|
|
end_date = fields.DateTime(
|
|
|
|
validate=validate_datetime_greater_than_now, required=True
|
|
|
|
)
|
|
|
|
project_supervisors = fields.List(
|
|
|
|
fields.Integer(required=True), validate=validate.Length(3, 3)
|
|
|
|
)
|
|
|
|
chairman_of_committee = fields.Integer(required=True)
|
2022-11-16 20:42:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
class ProjectSupervisorForTermOfDefenceSchema(Schema):
|
|
|
|
id = fields.Str()
|
|
|
|
first_name = fields.Str()
|
|
|
|
last_name = fields.Str()
|
|
|
|
|
|
|
|
|
|
|
|
class TermOfDefenceItemSchema(Schema):
|
2022-11-19 20:43:05 +01:00
|
|
|
id = fields.Integer()
|
2022-11-16 20:42:40 +01:00
|
|
|
start_date = fields.DateTime()
|
|
|
|
end_date = fields.DateTime()
|
2023-01-14 17:38:03 +01:00
|
|
|
members_of_committee = fields.List(
|
|
|
|
fields.Nested(ProjectSupervisorForTermOfDefenceSchema)
|
|
|
|
)
|
|
|
|
chairman_of_committee = fields.Integer()
|
2022-11-16 20:42:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
class TermOfDefenceListSchema(Schema):
|
|
|
|
term_of_defences = fields.List(fields.Nested(TermOfDefenceItemSchema))
|
|
|
|
|
|
|
|
|
2023-01-14 17:38:03 +01:00
|
|
|
class StudentDataItemAssignedGroupSchema(Schema):
|
2022-11-19 20:43:05 +01:00
|
|
|
index = fields.Integer()
|
|
|
|
first_name = fields.Str()
|
|
|
|
last_name = fields.Str()
|
|
|
|
|
|
|
|
|
2023-01-14 17:38:03 +01:00
|
|
|
class GroupDataItemAssignedGroupSchema(Schema):
|
2022-11-19 20:43:05 +01:00
|
|
|
name = fields.Str()
|
2023-01-14 17:38:03 +01:00
|
|
|
students = fields.List(fields.Nested(StudentDataItemAssignedGroupSchema))
|
2022-11-19 20:43:05 +01:00
|
|
|
|
|
|
|
|
2023-01-14 17:38:03 +01:00
|
|
|
class AssignedGroupToTermOfDefenceDataItemSchema(TermOfDefenceItemSchema):
|
|
|
|
group = fields.Nested(GroupDataItemAssignedGroupSchema)
|
2022-11-19 20:43:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
class AssignedGroupToTermOfDefenceListSchema(Schema):
|
2023-01-14 17:38:03 +01:00
|
|
|
term_of_defences = fields.List(
|
|
|
|
fields.Nested(AssignedGroupToTermOfDefenceDataItemSchema)
|
|
|
|
)
|
2022-11-19 20:43:05 +01:00
|
|
|
|
|
|
|
|
2022-11-16 20:42:40 +01:00
|
|
|
class ProjectSupervisorForTemporaryAvailabilitySchema(Schema):
|
|
|
|
id = fields.Str()
|
|
|
|
first_name = fields.Str()
|
|
|
|
last_name = fields.Str()
|
|
|
|
|
|
|
|
|
|
|
|
class TemporaryAvailabilityItemSchema(Schema):
|
|
|
|
start_date = fields.DateTime()
|
|
|
|
end_date = fields.DateTime()
|
|
|
|
project_supervisor = fields.Nested(ProjectSupervisorForTemporaryAvailabilitySchema)
|
|
|
|
|
|
|
|
|
|
|
|
class TemporaryAvailabilityListSchema(Schema):
|
2023-01-14 17:38:03 +01:00
|
|
|
temporary_availabilities = fields.List(
|
|
|
|
fields.Nested(TemporaryAvailabilityItemSchema)
|
|
|
|
)
|