Skip to content

Commit

Permalink
upfront and tiered pricing demo
Browse files Browse the repository at this point in the history
  • Loading branch information
daroczig committed Jan 9, 2024
1 parent 0af310f commit e2045f5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion sc_crawler/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,16 @@ class Server(SQLModel, table=True):

class Allocation(str, Enum):
ONDEMAND = "ondemand"
RESERVED = "reserved"
SPOT = "spot"


class PriceTier(Json):
lower: float
upper: float
price: float


class Price(SQLModel, table=True):
id: int = Field(primary_key=True)
vendor_id: str = Field(foreign_key="vendor.id")
Expand All @@ -312,7 +319,11 @@ class Price(SQLModel, table=True):
traffic_id: Optional[str] = Field(default=None, foreign_key="addon_traffic.id")
storage_id: Optional[str] = Field(default=None, foreign_key="addon_storage.id")
allocation: Allocation = "ondemand"
price: float
price: float # max price if tiered
# e.g. setup fee for dedicated servers, or upfront costs of a reserved instance type
price_upfront: float = 0
# TODO needs time interval as well and other complications .. maybe skip for now?
price_tiered: List[PriceTier] = Field(default=[], sa_column=Column(JSON))
currency: str = "USD"

vendor: Vendor = Relationship(back_populates="prices")
Expand Down

0 comments on commit e2045f5

Please sign in to comment.