16 lines
483 B
Python
16 lines
483 B
Python
from datetime import datetime
|
|
|
|
from marshmallow import ValidationError
|
|
|
|
|
|
def validate_index(index: int) -> None:
|
|
if len(str(index)) > 6:
|
|
raise ValidationError("Length of index is too long!")
|
|
elif len(str(index)) < 6:
|
|
raise ValidationError("Length of index is too short!")
|
|
|
|
|
|
def validate_datetime_greater_than_now(date: datetime) -> None:
|
|
if date.timestamp() < datetime.utcnow().timestamp():
|
|
raise ValidationError("Date must be greater than NOW!")
|