Add required details

This commit is contained in:
Jacob Windsor 2025-02-19 17:16:00 +01:00
parent 8a4c6c474b
commit 9cbbdcf323
3 changed files with 17 additions and 0 deletions

View File

@ -21,3 +21,14 @@ class HouseCreateRequest(BaseModel):
description="Description of the house", description="Description of the house",
examples=["A beautiful 3-bedroom house"], examples=["A beautiful 3-bedroom house"],
) )
square_feet: float = Field(
...,
description="Square footage of the house",
examples=[1500.00],
)
bedrooms: int = Field(
..., description="Number of bedrooms in the house", examples=[3]
)
bathrooms: float = Field(
..., description="Number of bathrooms in the house", examples=[2.5]
)

View File

@ -11,3 +11,6 @@ class House(SQLModel, table=True):
price: float = Field() price: float = Field()
description: str = Field() description: str = Field()
owner_user_id: UUID = Field(foreign_key="owner.user_id") owner_user_id: UUID = Field(foreign_key="owner.user_id")
square_feet: float = Field()
bedrooms: int = Field()
bathrooms: float = Field()

View File

@ -35,6 +35,9 @@ async def create_house(
country=body.country, country=body.country,
price=body.price, price=body.price,
description=body.description, description=body.description,
square_feet=body.square_feet,
bedrooms=body.bedrooms,
bathrooms=body.bathrooms,
) )
await house_repository.save(house) await house_repository.save(house)