-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Исправляет и дополняет схемы для взаимодействия с уровнями
- Loading branch information
1 parent
955a0dc
commit 8b7858d
Showing
8 changed files
with
122 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,51 @@ | ||
import uuid | ||
from uuid import UUID | ||
|
||
from pydantic import BaseModel, ConfigDict | ||
|
||
from game.units.tasks.questions.models import QuestionTypes | ||
|
||
|
||
# region Question | ||
class __QuestionBase(BaseModel): | ||
task_id: UUID | ||
type: QuestionTypes | ||
question: str | ||
possible_answers: list[str] | ||
|
||
model_config = ConfigDict(from_attributes=True) | ||
|
||
# TODO QuestionRead, QuestionCreate, QuestionUpdate | ||
|
||
class QuestionRead(__QuestionBase): | ||
id: UUID | ||
possible_answers: list["AnswerRead"] | ||
|
||
|
||
class QuestionCreate(__QuestionBase): | ||
correct_answer: "AnswerCreate" | ||
possible_answers: list["AnswerCreate"] | ||
|
||
|
||
class QuestionUpdate(__QuestionBase): | ||
type: QuestionTypes | None = None | ||
question: str | None = None | ||
possible_answers: list["AnswerUpdate"] | None = None | ||
|
||
|
||
# endregion Question | ||
|
||
# region Answer | ||
class __AnswerBase(BaseModel): | ||
content: str | ||
|
||
|
||
class AnswerRead(__AnswerBase): | ||
question_id: UUID | ||
|
||
|
||
class AnswerCreate(__AnswerBase): | ||
pass | ||
|
||
|
||
class AnswerUpdate(__AnswerBase): | ||
content: str | None = None | ||
question_id: UUID | None = None | ||
# endregion Answer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters