more inventory management work

This commit is contained in:
2025-04-22 16:44:47 -04:00
parent d8ae45c025
commit 210a033695
11 changed files with 1070 additions and 131 deletions

View File

@ -0,0 +1,28 @@
from app.models.tcgplayer_product import TCGPlayerProduct
from sqlalchemy.orm import Session
class InventoryProductContext:
def __init__(self, product: TCGPlayerProduct, db: Session):
self.product = product
self.prices = product.most_recent_tcgplayer_price
self.db = db
@property
def market_price(self) -> float:
return self.product.most_recent_tcgplayer_price.market_price
@property
def low_price(self) -> float:
return self.product.most_recent_tcgplayer_price.low_price
@property
def name(self) -> str:
return self.product.name
@property
def image_url(self) -> str:
return self.product.image_url
@property
def id(self) -> int:
return self.product.id