use query params to filter out models; also make csv exporter work with models
This commit is contained in:
parent
80c335ba04
commit
e317d2ec54
5 changed files with 72 additions and 113 deletions
|
|
@ -132,7 +132,8 @@ class Listing(SQLModel, table=False):
|
|||
class FurnishType(enum.StrEnum):
|
||||
FURNISHED = "furnished"
|
||||
UNFURNISHED = "unfurnished"
|
||||
PART_FURNISHED = "partFurnished"
|
||||
PART_FURNISHED = "part furnished"
|
||||
ASK_LANDLORD = "ask landlord"
|
||||
UNKNOWN = "unknown"
|
||||
|
||||
|
||||
|
|
@ -156,25 +157,6 @@ class DestinationMode:
|
|||
def __hash__(self) -> int:
|
||||
return hash((self.destination_address, self.travel_mode))
|
||||
|
||||
# def to_dict(self) -> dict[str, str | routing.TravelMode]:
|
||||
# return {
|
||||
# "destination_address": self.destination_address,
|
||||
# "travel_mode": self.travel_mode.value,
|
||||
# }
|
||||
|
||||
# @classmethod
|
||||
# def from_dict(cls, data: dict):
|
||||
# return cls(
|
||||
# destination_address=data["destination_address"],
|
||||
# travel_mode=routing.TravelMode(data["travel_mode"]),
|
||||
# )
|
||||
|
||||
# def __json__(self) -> dict[str, str | routing.TravelMode]:
|
||||
# return {
|
||||
# "destination_address": self.destination_address,
|
||||
# "travel_mode": self.travel_mode.value,
|
||||
# }
|
||||
|
||||
def __getstate__(self):
|
||||
# This allows serializers to pick up a dict representation
|
||||
return asdict(self)
|
||||
|
|
@ -182,3 +164,28 @@ class DestinationMode:
|
|||
def __iter__(self):
|
||||
# Makes it behave like a dict when expected
|
||||
return iter(asdict(self).items())
|
||||
|
||||
|
||||
class ListingType(enum.StrEnum):
|
||||
BUY = "BUY"
|
||||
RENT = "RENT"
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class QueryParameters:
|
||||
listing_type: ListingType
|
||||
min_bedrooms: int = 1
|
||||
max_bedrooms: int = 999
|
||||
min_price: int = 0
|
||||
max_price: int = 10_000_000
|
||||
district_names: set[str] = dataclasses.field(default_factory=set)
|
||||
radius: float = 0
|
||||
page_size: int = 500 # items per page
|
||||
max_days_since_added: int = 30
|
||||
furnish_types: list[FurnishType] | None = None
|
||||
# The values below are not supported by rightmove
|
||||
# hence we apply them after fetching
|
||||
# available from; council tax
|
||||
let_date_available_from: datetime | None = None
|
||||
last_seen_days: int | None = None
|
||||
min_sqm: int | None = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue