Skip to content
Snippets Groups Projects
Verified Commit 2df2ed31 authored by hanfi's avatar hanfi
Browse files

remove unused code

parent 33b00b6b
Branches
No related tags found
No related merge requests found
...@@ -74,7 +74,7 @@ def check_token(token: str, item_uuid: str): ...@@ -74,7 +74,7 @@ def check_token(token: str, item_uuid: str):
@app.post("/token") @app.post("/token")
def verify_supporter(form_data: OAuth2PasswordRequestForm = Depends()): def verify_supporter(form_data: OAuth2PasswordRequestForm = Depends()):
if form_data.password != settings.shared_secret: if form_data.password != settings.shared_secret:
raise HTTPException(status_code=400, detail="Incorrect username or password") raise HTTPException(status_code=401, detail="Incorrect username or password")
return { return {
"access_token": oauth2_tokener.dumps("all"), "access_token": oauth2_tokener.dumps("all"),
"token_type": "bearer", "token_type": "bearer",
...@@ -204,90 +204,3 @@ def add_item_with_image( ...@@ -204,90 +204,3 @@ def add_item_with_image(
check_token(token, None) check_token(token, None)
print(image.file) print(image.file)
return False # utils.add_item_with_image(db, image) return False # utils.add_item_with_image(db, image)
# @app.post("/item/update/{item_uuid}", response_model=schemas.Delivery)
# def update_item(
# item_uuid: str,
# data: schemas.ItemUpdate,
# token: str = Depends(oauth2_scheme),
# db: Session = Depends(get_db),
# ):
# check_token(token, item_uuid)
# item = utils.get_item_by_uuid(db, UUID(item_uuid))
# if not item:
# raise HTTPException(status_code=404, detail="Item not found")
# return utils.update_item(db, item, data)
# @app.get("/item/{item_uuid}", response_model=schemas.Delivery)
# def get_item(
# item_uuid: str, token: str = Depends(oauth2_scheme), db: Session = Depends(get_db)
# ):
# item = utils.get_item_by_uuid(db, UUID(item_uuid))
# if not item:
# raise HTTPException(status_code=404, detail="Item not found")
# return item
# @app.get("/items", response_model=list[schemas.Delivery])
# def get_items(token: str = Depends(oauth2_scheme), db: Session = Depends(get_db)):
# print(token)
# check_token(token, None)
# return utils.get_stored_items(db)
# @app.get("/tag/{tag}", response_model=schemas.Delivery)
# def get_item_by_tag(
# tag: str, token: str = Depends(oauth2_scheme), db: Session = Depends(get_db)
# ):
# check_token(token, None)
# item = utils.get_item_by_tag(db, tag)
# if not item:
# raise HTTPException(status_code=404, detail="Item not found")
# return item
# @app.get("/storage/{storage_name}", response_model=list[schemas.Delivery])
# def get_storage(
# storage_name: str,
# token: str = Depends(oauth2_scheme),
# db: Session = Depends(get_db),
# ):
# check_token(token, None)
# return utils.get_items_for_storage(db, storage_name)
# @app.get("/storages", response_model=list[schemas.Storage])
# def list_storages(token: str = Depends(oauth2_scheme), db: Session = Depends(get_db)):
# check_token(token, None)
# return utils.get_storages(db)
# @app.post("/checkin", response_model=schemas.Delivery)
# def checkin_item_by_uuid(
# checkin: schemas.ItemCheckin,
# token: str = Depends(oauth2_scheme),
# db: Session = Depends(get_db),
# ):
# check_token(token, None)
# item = utils.get_item_by_uuid(db, UUID(checkin.item_uuid))
# if item is None:
# raise HTTPException(status_code=404, detail="Item not found")
# storage = utils.get_storage(db, checkin.storage_name)
# if storage is None:
# raise HTTPException(status_code=404, detail="Storage not found")
# return utils.receive_item(db, item, storage)
# @app.get("/checkout/{item_uuid}", response_model=schemas.Delivery)
# def checkout_item(
# item_uuid: str,
# token: str = Depends(oauth2_scheme),
# db: Session = Depends(get_db),
# ):
# check_token(token, None)
# item = utils.get_item_by_uuid(db, UUID(item_uuid))
# if item is None:
# raise HTTPException(status_code=404, detail="Item not found")
# return utils.deliver_item(db, item)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment