30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
|
from marshmallow import fields, validate, Schema
|
||
|
|
||
|
from ..validators import validate_datetime_greater_than_now
|
||
|
|
||
|
|
||
|
class ExaminationScheduleSchema(Schema):
|
||
|
title = fields.Str(validate=validate.Length(min=1, max=100), required=True)
|
||
|
|
||
|
|
||
|
class ExaminationScheduleUpdateSchema(Schema):
|
||
|
start_date = fields.DateTime(validate=validate_datetime_greater_than_now, required=True)
|
||
|
end_date = fields.DateTime(validate=validate_datetime_greater_than_now, required=True)
|
||
|
|
||
|
|
||
|
class ExaminationScheduleListItemSchema(Schema):
|
||
|
id = fields.Integer(required=True)
|
||
|
title = fields.Str(validate=validate.Length(min=1, max=100), required=True)
|
||
|
start_date = fields.DateTime(validate=validate_datetime_greater_than_now, required=True)
|
||
|
end_date = fields.DateTime(validate=validate_datetime_greater_than_now, required=True)
|
||
|
|
||
|
|
||
|
class ExaminationSchedulesPaginationSchema(Schema):
|
||
|
examination_schedules = fields.List(fields.Nested(ExaminationScheduleListItemSchema))
|
||
|
max_pages = fields.Integer()
|
||
|
|
||
|
|
||
|
class ExaminationSchedulesQuerySchema(Schema):
|
||
|
page = fields.Integer()
|
||
|
per_page = fields.Integer()
|