chore: document briefly

This commit is contained in:
surtur 2020-08-07 03:10:37 +02:00
parent 5c8af2930b
commit 79b77acaef
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

@ -41,14 +41,17 @@ def get_srv(service_id: int, db: Session):
@app.get("/api/v1/ping")
async def pong():
"""Basic sanity check"""
return {"ping": "pong!"}
@app.get("/api/v1/service")
async def read_services(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
"""List all services"""
return crud.get_services(db, skip=skip, limit=limit)
@app.post("/api/v1/service", response_model=schemas.Service)
async def create_service(service: schemas.ServiceCreate, db: Session = Depends(get_db)):
"""Service types: icmp = 0, http = 1, ssh=2"""
return crud.create_service(db=db, service=service)
@app.get("/api/v1/service/{service_id}", response_model=schemas.Service)
@ -87,6 +90,7 @@ async def create_user(user: schemas.UserCreate, db: Session = Depends(get_db)):
@app.get("/api/v1/users", response_model=List[schemas.User])
async def read_users(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
"""List all users"""
return crud.get_users(db=db, skip=skip, limit=limit)
@app.get("/api/v1/users/{user_id}", response_model=schemas.User)