diff --git a/app/models/pricing.py b/app/models/pricing.py index e3707e0..65f9429 100755 --- a/app/models/pricing.py +++ b/app/models/pricing.py @@ -12,11 +12,13 @@ class Pricing_Oil_Oil(Base): autoincrement=True, unique=False) - price_from_supplier = Column(DECIMAL(50, 2)) - price_for_customer = Column(DECIMAL(50, 2)) - price_for_employee = Column(DECIMAL(50, 2)) - price_same_day = Column(DECIMAL(50, 2)) - price_prime = Column(DECIMAL(50, 2)) + price_from_supplier = Column(DECIMAL(6, 2)) + price_for_customer = Column(DECIMAL(6, 2)) + price_for_employee = Column(DECIMAL(6, 2)) + price_same_day = Column(DECIMAL(6, 2)) + price_same_day = Column(DECIMAL(6, 2)) + price_prime = Column(DECIMAL(6, 2)) + #price_emergency = Column(DECIMAL(6, 2)) date = Column(TIMESTAMP(), default=datetime.utcnow()) diff --git a/app/routers/info.py b/app/routers/info.py index 53afe51..fc87fd8 100755 --- a/app/routers/info.py +++ b/app/routers/info.py @@ -17,7 +17,7 @@ router = APIRouter( @router.get("/price/today") async def get_todays_price_of_oil(): - + get_current_prices = (session.query(Pricing_Oil_Oil) .order_by(Pricing_Oil_Oil.id.desc()) .first()) @@ -28,7 +28,24 @@ async def get_todays_price_of_oil(): "todays_price": current_price } +@router.get("/price/oil/items") +async def get_todays_price_of_items_for_oil(): + get_current_prices = (session.query(Pricing_Oil_Oil) + .order_by(Pricing_Oil_Oil.id.desc()) + .first()) + + price_same_day = str(get_current_prices.price_same_day) + price_prime = str(get_current_prices.price_prime) + #price_emergency = str(get_current_prices.price_emergency) + return { + "ok": True, + "price_same_day": price_same_day, + "price_prime": price_prime, + # "price_emergency": price_emergency, + } + + @router.get("/company") async def get_company():