first commit
This commit is contained in:
0
app/routers/__init__.py
Executable file
0
app/routers/__init__.py
Executable file
BIN
app/routers/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
app/routers/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
app/routers/__pycache__/command.cpython-312.pyc
Executable file
BIN
app/routers/__pycache__/command.cpython-312.pyc
Executable file
Binary file not shown.
BIN
app/routers/__pycache__/delivery.cpython-312.pyc
Normal file
BIN
app/routers/__pycache__/delivery.cpython-312.pyc
Normal file
Binary file not shown.
BIN
app/routers/__pycache__/info.cpython-312.pyc
Normal file
BIN
app/routers/__pycache__/info.cpython-312.pyc
Normal file
Binary file not shown.
BIN
app/routers/__pycache__/printstatus.cpython-312.pyc
Executable file
BIN
app/routers/__pycache__/printstatus.cpython-312.pyc
Executable file
Binary file not shown.
52
app/routers/info.py
Executable file
52
app/routers/info.py
Executable file
@@ -0,0 +1,52 @@
|
||||
|
||||
|
||||
from fastapi import APIRouter
|
||||
from app.database import session
|
||||
import os
|
||||
from app.schema.price import SchemaPricing
|
||||
from app.models.admin import Admin_Company
|
||||
from app.models.pricing import Pricing_Oil_Oil
|
||||
|
||||
|
||||
router = APIRouter(
|
||||
prefix="/info",
|
||||
tags=["info"],
|
||||
responses={404: {"description": "Not found"}},
|
||||
)
|
||||
|
||||
|
||||
@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())
|
||||
|
||||
current_price = str(get_current_prices.price_for_customer)
|
||||
return {
|
||||
"ok": True,
|
||||
"todays_price": current_price
|
||||
}
|
||||
|
||||
|
||||
|
||||
@router.get("/company")
|
||||
async def get_company():
|
||||
company = os.getenv("COMPANYID")
|
||||
|
||||
|
||||
get_company_info = (session.query(Admin_Company)
|
||||
.filter(Admin_Company.id == company)
|
||||
.first())
|
||||
|
||||
company_phone_number = get_company_info.company_phone_number
|
||||
company_name = get_company_info.company_name
|
||||
|
||||
return {
|
||||
"ok": True,
|
||||
"company_phone_number": company_phone_number,
|
||||
"company_name": company_name
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user