Skip to content
Snippets Groups Projects
Commit 35a34ac8 authored by Tim Neumann's avatar Tim Neumann
Browse files

fix(auth): Protect /storages and /tag endpoints

Resolves: #1
parent 638676c2
No related branches found
No related tags found
2 merge requests!4fix(auth): Protect /storages and /tag endpoints,!3fix(auth): Protect /storages and /tag endpoints
......@@ -111,7 +111,8 @@ def get_items(token: str = Depends(oauth2_scheme), db: Session = Depends(get_db)
@app.get("/tag/{tag}", response_model=schemas.Item)
def get_item_by_tag(tag: str, db: Session = Depends(get_db)):
def get_item_by_tag(tag: str, token: str = Depends(oauth2_scheme), db: Session = Depends(get_db)):
check_token(token)
item = utils.get_item_by_tag(db, tag)
if not item:
raise HTTPException(status_code=404, detail="Item not found")
......@@ -119,7 +120,8 @@ def get_item_by_tag(tag: str, db: Session = Depends(get_db)):
@app.get("/storages", response_model=list[schemas.Storage])
def list_storages(db: Session = Depends(get_db)):
def list_storages(token: str = Depends(oauth2_scheme), db: Session = Depends(get_db)):
check_token(token)
return utils.get_storages(db)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment