updated models for price

This commit is contained in:
2024-09-23 18:13:40 -04:00
parent bc2879616e
commit b0d94619d9
2 changed files with 25 additions and 6 deletions

View File

@@ -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())

View File

@@ -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():