Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
13th
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
13th
13th
Commits
dee07866
Commit
dee07866
authored
2 years ago
by
radvalig
Browse files
Options
Downloads
Patches
Plain Diff
fixed retrival of all items
parent
393f4e88
No related branches found
Branches containing commit
No related tags found
1 merge request
!4
Authentication with jwt
Pipeline
#14716
failed
2 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/tjts5901/app.py
+1
-1
1 addition, 1 deletion
src/tjts5901/app.py
src/tjts5901/backend/item_api.py
+13
-4
13 additions, 4 deletions
src/tjts5901/backend/item_api.py
with
14 additions
and
5 deletions
src/tjts5901/app.py
+
1
−
1
View file @
dee07866
...
...
@@ -105,7 +105,7 @@ api = Api(flask_app)
jwt
=
JWTManager
(
flask_app
)
# added auction item resource
api
.
add_resource
(
items
.
AuctionItem
,
"
/auction_item/<id>
"
)
api
.
add_resource
(
items
.
AuctionItem
,
"
/auction_item/
"
,
"
/auction_item/<id>
"
)
@flask_app.route
(
"
/server-info
"
)
...
...
This diff is collapsed.
Click to expand it.
src/tjts5901/backend/item_api.py
+
13
−
4
View file @
dee07866
...
...
@@ -14,20 +14,29 @@ ITEM_ENDPOINT : str = r"/auction_item"
logger
=
logging
.
getLogger
(
__name__
)
class
AuctionItem
(
Resource
):
"""
Auction item class
that will for handling this object
"""
Auction item class
used to represent resource, and create GET, POST calls
Args:
Resource (_type_): _description_
"""
@jwt_required
#
@jwt_required
def
get
(
self
,
id
=
None
):
"""
GET method
Args:
id (str, optional): id for specif item, if it is not provided it will return all items. Defaults to None.
Returns:
json: json representation of item objects
"""
#current_user = get_jwt_identity()
item
=
items
.
Item
()
if
not
id
:
logger
.
info
(
"
retriving
item without id
!
"
)
logger
.
info
(
"
retriving
all items
!
"
)
query_result
=
item
.
get_all
()
temp
=
json
.
dumps
(
query_result
,
default
=
str
)
item_from_db
=
[
item_from_db
for
item_from_db
in
query_result
]
temp
=
json
.
dumps
(
item_from_db
,
default
=
str
)
return
temp
logger
.
info
(
f
"
Trying to retrive a item with id:
{
id
}
"
)
...
...
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