aboutsummaryrefslogtreecommitdiffstats
path: root/backend/models/question.py
diff options
context:
space:
mode:
Diffstat (limited to 'backend/models/question.py')
-rw-r--r--backend/models/question.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/backend/models/question.py b/backend/models/question.py
index 1a012ff..3b98024 100644
--- a/backend/models/question.py
+++ b/backend/models/question.py
@@ -11,7 +11,7 @@ class Question(BaseModel):
id: str = Field(alias="_id")
name: str
type: str
- data: t.Dict[str, t.Any]
+ data: dict[str, t.Any]
class Config:
allow_population_by_field_name = True
@@ -31,14 +31,14 @@ class Question(BaseModel):
@root_validator
def validate_question_data(
cls,
- value: t.Dict[str, t.Any]
- ) -> t.Optional[t.Dict[str, t.Any]]:
+ value: dict[str, t.Any]
+ ) -> t.Optional[dict[str, t.Any]]:
"""Check does required data exists for question type and remove other data."""
# When question type don't need data, don't add anything to keep DB clean.
if value.get("type") not in REQUIRED_QUESTION_TYPE_DATA:
return value
- for key, data_type in REQUIRED_QUESTION_TYPE_DATA[value.get("type")].items():
+ for key, data_type in REQUIRED_QUESTION_TYPE_DATA[value["type"]].items():
if key not in value.get("data", {}):
raise ValueError(f"Required question data key '{key}' not provided.")