diff options
Diffstat (limited to 'backend/models/form_response.py')
-rw-r--r-- | backend/models/form_response.py | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/backend/models/form_response.py b/backend/models/form_response.py index 9fffdde..bea070f 100644 --- a/backend/models/form_response.py +++ b/backend/models/form_response.py @@ -1,8 +1,7 @@ import typing as t -from pydantic import BaseModel, Field, root_validator +from pydantic import BaseModel, Field -from backend.constants import FormFeatures from .antispam import AntiSpam from .discord_user import DiscordUser @@ -18,19 +17,3 @@ class FormResponse(BaseModel): class Config: allow_population_by_field_name = True - - @root_validator - def validate_data(cls, values: t.Dict[str, t.Any]) -> t.Dict[str, t.Any]: - """Validates is all required (based on flags) is provided.""" - flags = values.get("flags", []) - - if FormFeatures.DISABLE_ANTISPAM not in flags and values.get("antispam") is None: # noqa - raise ValueError("Antispam information required.") - - if FormFeatures.REQUIRES_LOGIN in flags: - if values.get("user") is None: - raise ValueError("User information required.") - - values["user"]["require_email"] = FormFeatures.COLLECT_EMAIL in flags - - return values |