Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 4911f0ea

Přidáno uživatelem Matěj Zeman před asi 2 roky(ů)

re #9577 Api code documentation.

Zobrazit rozdíly:

server/sql_app/api/usb_logs_web.py
10 10
from fastapi.templating import Jinja2Templates
11 11

  
12 12
models.Base.metadata.create_all(bind=engine)
13
templates = Jinja2Templates(directory="templates/usb-logs")
14 13

  
14
# Path to html templates used in this file
15
templates = Jinja2Templates(directory="../templates/usb-logs")
16

  
17
# prefix used for all endpoints in this file
15 18
usblogs_web = APIRouter(prefix="/api/v1")
16 19

  
17 20

  
......
26 29

  
27 30
@usblogs_web.get("/logs-web", response_class=HTMLResponse)
28 31
async def read_logs(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
32
    """
33
    Returns template with all usb logs currently saved in database with its pcs, teams and licenses.
34
    """
29 35
    logs = crud.get_logs(db, skip=skip, limit=limit)
30 36
    pcs = []
31 37
    for log in logs:
......
42 48
async def filter_logs(request: Request, pc: str = Form("all"), team: str = Form("all"), lic: str = Form("all"),
43 49
                      skip: int = 0, limit: int = 100,
44 50
                      db: Session = Depends(get_db)):
51
    """
52
    Endpoint used for filtering usb logs by user given form inputs.
53
    """
45 54
    log = crud.get_filtered_logs(db, pc, team, lic)
46 55
    logs_ids = []
47 56
    for l in log:

Také k dispozici: Unified diff