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
8f9e25d8
Verified
Commit
8f9e25d8
authored
1 year ago
by
hanfi
Browse files
Options
Downloads
Patches
Plain Diff
add checkout
parent
f277465f
Branches
Branches containing commit
No related tags found
1 merge request
!5
merge from staging
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
backend/main.py
+13
-0
13 additions, 0 deletions
backend/main.py
backend/utils.py
+7
-0
7 additions, 0 deletions
backend/utils.py
with
20 additions
and
0 deletions
backend/main.py
+
13
−
0
View file @
8f9e25d8
...
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
backend/utils.py
+
7
−
0
View file @
8f9e25d8
...
...
@@ -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
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