Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chaos Parcel Service
backend
Commits
2df2ed31
Verified
Commit
2df2ed31
authored
1 year ago
by
hanfi
Browse files
Options
Downloads
Patches
Plain Diff
remove unused code
parent
33b00b6b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
backend/main.py
+1
-88
1 addition, 88 deletions
backend/main.py
with
1 addition
and
88 deletions
backend/main.py
+
1
−
88
View file @
2df2ed31
...
@@ -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
=
40
0
,
detail
=
"
Incorrect username or password
"
)
raise
HTTPException
(
status_code
=
40
1
,
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)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment