feat: ai letter + disabled fl
This commit is contained in:
@@ -19,3 +19,32 @@ class Offer:
|
||||
@property
|
||||
def dedup_key(self) -> str:
|
||||
return f"{self.source}:{self.external_id}"
|
||||
|
||||
def to_dict(self) -> dict[str, str | int | None]:
|
||||
return {
|
||||
"source": self.source,
|
||||
"external_id": self.external_id,
|
||||
"title": self.title,
|
||||
"description": self.description,
|
||||
"price": self.price,
|
||||
"price_amount": self.price_amount,
|
||||
"url": self.url,
|
||||
"category_id": self.category_id,
|
||||
"published_at": self.published_at,
|
||||
"seller_username": self.seller_username,
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data: dict[str, str | int | None]) -> "Offer":
|
||||
return cls(
|
||||
source=str(data["source"]),
|
||||
external_id=str(data["external_id"]),
|
||||
title=str(data["title"]),
|
||||
description=str(data["description"]),
|
||||
price=str(data["price"]),
|
||||
price_amount=int(data["price_amount"]) if data["price_amount"] is not None else None,
|
||||
url=str(data["url"]),
|
||||
category_id=int(data["category_id"]),
|
||||
published_at=str(data["published_at"]),
|
||||
seller_username=str(data["seller_username"]) if data["seller_username"] is not None else None,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user