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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chaos Parcel Service
backend
Commits
d8c869eb
Verified
Commit
d8c869eb
authored
Jun 16, 2023
by
hanfi
Browse files
Options
Downloads
Patches
Plain Diff
fix checkin
parent
8eaa389f
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
backend/main.py
+4
-6
4 additions, 6 deletions
backend/main.py
backend/models.py
+1
-1
1 addition, 1 deletion
backend/models.py
backend/schemas.py
+9
-1
9 additions, 1 deletion
backend/schemas.py
with
14 additions
and
8 deletions
backend/main.py
+
4
−
6
View file @
d8c869eb
...
...
@@ -58,14 +58,12 @@ def list_storages(db: Session = Depends(get_db)):
return
utils
.
get_storages
(
db
)
@app.post
(
"
/checkin/{item_uuid}/at/{storage_name}
"
,
response_model
=
schemas
.
Item
)
def
checkin_item_by_uuid
(
item_uuid
:
str
,
storage_name
:
str
,
db
:
Session
=
Depends
(
get_db
)
):
item
=
utils
.
get_item_by_uuid
(
db
,
UUID
(
item_uuid
))
@app.post
(
"
/checkin
"
,
response_model
=
schemas
.
Item
)
def
checkin_item_by_uuid
(
checkin
:
schemas
.
ItemCheckin
,
db
:
Session
=
Depends
(
get_db
)):
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
,
storage_name
)
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
)
This diff is collapsed.
Click to expand it.
backend/models.py
+
1
−
1
View file @
d8c869eb
...
...
@@ -31,7 +31,7 @@ class Item(db_Base):
tag
=
sql_Column
(
sql_String
(
6
),
nullable
=
True
,
default
=
None
)
storage
=
sql_Column
(
sql_
Uuid
,
sql_ForeignKey
(
"
store.name
"
),
nullable
=
True
,
default
=
None
sql_
String
(
16
)
,
sql_ForeignKey
(
"
store.name
"
),
nullable
=
True
,
default
=
None
)
stored_at
=
sql_relationship
(
"
Storage
"
,
back_populates
=
"
items
"
)
...
...
This diff is collapsed.
Click to expand it.
backend/schemas.py
+
9
−
1
View file @
d8c869eb
...
...
@@ -30,11 +30,19 @@ class ItemCreateByImageAtStorage(BaseModel):
storage_uuid
:
UUID4
class
ItemCheckin
(
BaseModel
):
item_uuid
:
str
storage_name
:
str
num
:
Union
[
int
,
None
]
=
1
class
Item
(
BaseModel
):
uuid
:
UUID4
created_at
:
datetime
received_at
:
Union
[
datetime
,
None
]
=
None
verification
:
bytes
addressee
:
Union
[
str
,
None
]
=
None
team
:
Union
[
str
,
None
]
=
None
images
:
List
[
Image
]
=
[]
...
...
@@ -44,7 +52,7 @@ class Item(BaseModel):
tag
:
Union
[
str
,
None
]
=
None
stor
ed_at
:
Union
[
Storage
,
None
]
=
None
stor
age
:
Union
[
str
,
None
]
=
None
class
Config
:
orm_mode
=
True
...
...
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