Updates
This commit is contained in:
20
app/main.py
20
app/main.py
@@ -1,9 +1,10 @@
|
|||||||
|
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
from app.routers import (cron_print, printstatus,
|
from app.routers import (cron_print,
|
||||||
|
printstatus,
|
||||||
command,
|
command,
|
||||||
)
|
)
|
||||||
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -15,6 +16,21 @@ app.include_router(printstatus.router)
|
|||||||
app.include_router(command.router)
|
app.include_router(command.router)
|
||||||
app.include_router(cron_print.router)
|
app.include_router(cron_print.router)
|
||||||
|
|
||||||
|
origins = [
|
||||||
|
"http://localhost:9000",
|
||||||
|
"https://localhost:5173",
|
||||||
|
"http://localhost",
|
||||||
|
"*",
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
app.add_middleware(
|
||||||
|
CORSMiddleware,
|
||||||
|
allow_origins=origins,
|
||||||
|
allow_credentials=True,
|
||||||
|
allow_methods=["*"],
|
||||||
|
allow_headers=["*"],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/")
|
@app.get("/")
|
||||||
|
|||||||
@@ -12,9 +12,8 @@ router = APIRouter(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/printticket/{delivery_id}")
|
@router.options("/printticket/{delivery_id}")
|
||||||
async def print_specific_ticket(delivery_id):
|
async def print_specific_ticket(delivery_id: int):
|
||||||
|
|
||||||
now = datetime.utcnow()
|
now = datetime.utcnow()
|
||||||
|
|
||||||
get_ticket = (session.query(Delivery)
|
get_ticket = (session.query(Delivery)
|
||||||
|
|||||||
Reference in New Issue
Block a user