fix typing
This commit is contained in:
parent
49008d0e93
commit
fa0aec4276
1 changed files with 6 additions and 13 deletions
|
@ -5,6 +5,7 @@ import time
|
|||
import os
|
||||
import unicodedata
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import FastAPI, HTTPException, Request, Response, BackgroundTasks
|
||||
from fastapi.responses import FileResponse, RedirectResponse, JSONResponse
|
||||
|
@ -68,8 +69,8 @@ def help():
|
|||
)
|
||||
|
||||
class CreateInfo(BaseModel):
|
||||
starttime: str = None
|
||||
endtime: str = None
|
||||
starttime: Optional[str] = None
|
||||
endtime: Optional[str] = None
|
||||
name: str = ""
|
||||
|
||||
@app.post("/api/create")
|
||||
|
@ -111,7 +112,7 @@ class UpdateInfo(BaseModel):
|
|||
name: str = ""
|
||||
starttime: int =Field(default_factory=timefield_factory)
|
||||
endtime: int =Field(default_factory=timefield_factory)
|
||||
filename: str = None
|
||||
filename: Optional[str] = None
|
||||
|
||||
@app.post("/api/update/{recid}")
|
||||
async def update(recid: int, req: UpdateInfo):
|
||||
|
@ -217,14 +218,6 @@ def check_job(recid: int):
|
|||
return ret("WIP")
|
||||
|
||||
|
||||
@app.get("/api/jobs")
|
||||
def running_jobs():
|
||||
res = {}
|
||||
res["last_job_id"] = pq.last_job_id
|
||||
res["running"] = pq.jobs.keys()
|
||||
return res
|
||||
|
||||
|
||||
@app.get("/api/get/search")
|
||||
def search(request: Request):
|
||||
req = dict()
|
||||
|
@ -232,9 +225,9 @@ def search(request: Request):
|
|||
logger.debug("Search request: %s" % (req))
|
||||
|
||||
values = db._search(**req)
|
||||
from pprint import pprint
|
||||
from pprint import pformat
|
||||
|
||||
logger.debug("Returned Values %s" % pprint([r.serialize() for r in values]))
|
||||
logger.debug("Returned Values %s" % pformat([r.serialize() for r in values]))
|
||||
|
||||
ret = {}
|
||||
for rec in values:
|
||||
|
|
Loading…
Reference in a new issue