aboutsummaryrefslogtreecommitdiffstats
path: root/backend/models/question.py
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2020-12-16 10:28:52 +0000
committerGravatar GitHub <[email protected]>2020-12-16 10:28:52 +0000
commit2c5610d1dbf5d6e8fb112d9dc4d93330a87c6708 (patch)
tree78b7f2269ef04da0f9c3f871ac45a00cf14ca3f6 /backend/models/question.py
parentMerge pull request #33 from python-discord/renovate/uvicorn-0.x (diff)
parentMerge branch 'main' into ks123/routes-parsing (diff)
Merge pull request #28 from python-discord/ks123/routes-parsing
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.")