mirror of
https://github.com/grey-cat-1908/formaptix-server.git
synced 2024-09-22 19:52:00 +03:00
some fixes
This commit is contained in:
parent
14f64a2817
commit
4c06904661
2 changed files with 4 additions and 3 deletions
|
@ -34,7 +34,7 @@ class BaseQuestion(BaseModel):
|
|||
question_type: QuestionType
|
||||
label: str = Field(min_length=1)
|
||||
description: str | None = Field(None, min_length=1)
|
||||
image_url: str | None
|
||||
image_url: str | None = None
|
||||
required: bool = True
|
||||
|
||||
@field_serializer("id")
|
||||
|
|
|
@ -74,10 +74,11 @@ async def user_forms(user: User):
|
|||
|
||||
|
||||
@router.get("/get")
|
||||
async def get_form(id: int) -> Form:
|
||||
async def get_form(id: int) -> Form | None:
|
||||
async with database.sessions.begin() as session:
|
||||
stmt = select(database.Form).where(database.Form.id == id)
|
||||
db_request = await session.execute(stmt)
|
||||
form = db_request.scalar_one_or_none()
|
||||
|
||||
if form is not None:
|
||||
return Form.model_validate(form)
|
||||
|
|
Loading…
Reference in a new issue