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

add checkout

parent f277465f
Branches
No related tags found
1 merge request!5merge from staging
......@@ -149,6 +149,19 @@ def checkin_item_by_uuid(
return utils.receive_item(db, item, storage)
@app.get("/checkout/{item_uuid}", response_model=schemas.Item)
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)
@app.post("/token")
def verify_supporter(form_data: OAuth2PasswordRequestForm = Depends()):
if form_data.password != settings.shared_secret:
......
......@@ -113,3 +113,10 @@ def receive_item(db: Session, item: schemas.Item, storage: schemas.Storage):
db.commit()
db.refresh(item)
return item
def deliver_item(db: Session, item: schemas.Item):
item.deployed_at = datetime.now()
db.commit()
db.refresh(item)
return item
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment