Что POST запрос сразу возращал answer
This commit is contained in:
parent
82e6075f3f
commit
0b619038ba
@ -38,7 +38,7 @@ class QuestionRepository:
|
||||
|
||||
await session.flush()
|
||||
await session.commit()
|
||||
return question.id
|
||||
return question.id, question.answer
|
||||
|
||||
@classmethod
|
||||
async def find_all(cls) -> list[SQuestion]:
|
||||
|
@ -17,8 +17,8 @@ async def add_question(
|
||||
type_mood: TypeMood, # Добавлен параметр type_mood
|
||||
type_model: TypeModel, # Добавлен параметр type_model
|
||||
) -> SQuestionId:
|
||||
question_id = await QuestionRepository.add_one(question, type_mood, type_model) # Передача параметров type_mood и type_model
|
||||
return {"ok": True, "question_id": question_id}
|
||||
question_id, answer = await QuestionRepository.add_one(question, type_mood, type_model) # Передача параметров type_mood и type_model
|
||||
return {"question_id": question_id, "answer": answer}
|
||||
|
||||
@router.get("")
|
||||
async def get_questions() -> list[SQuestion]:
|
||||
|
@ -17,8 +17,8 @@ class SQuestion(SQuestionAdd):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
class SQuestionId(BaseModel):
|
||||
ok: bool = True
|
||||
question_id: int
|
||||
answer: str
|
||||
|
||||
class Flight(BaseModel):
|
||||
id: int
|
||||
|
Loading…
Reference in New Issue
Block a user