Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flask-backend
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
retno sonjaya
flask-backend
Commits
3b871740
Commit
3b871740
authored
Aug 14, 2024
by
Beno Sons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
profile
parent
4a381be1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
app/routes/user.py
app/routes/user.py
+8
-2
No files found.
app/routes/user.py
View file @
3b871740
...
...
@@ -35,7 +35,13 @@ def get_users():
return
error_response
(
f
"Database connection failed: {connection_error}"
,
code
=
500
)
users
=
User
.
query
.
all
()
users_data
=
[{
"id"
:
user
.
id
,
"username"
:
user
.
username
,
"email"
:
user
.
email
,
"role_id"
:
[
role
.
name
for
role
in
user
.
roles
]}
for
user
in
users
]
users_data
=
[
Master
.
row2dict
(
user
)
for
user
in
users
]
for
usr
in
users_data
:
if
'password'
in
usr
:
del
usr
[
'password'
]
if
'current_refresh_token'
in
usr
:
del
usr
[
'current_refresh_token'
]
return
success_response
(
data
=
users_data
)
@
user_bp
.
route
(
'/<int:user_id>'
,
methods
=
[
'GET'
])
...
...
@@ -46,7 +52,7 @@ def get_user(user_id):
return
error_response
(
f
"Database connection failed: {connection_error}"
,
code
=
500
)
user
=
User
.
query
.
get_or_404
(
user_id
)
user_data
=
{
"id"
:
user
.
id
,
"username"
:
user
.
username
,
"email"
:
user
.
email
,
"role_id"
:
[
role
.
name
for
role
in
user
.
roles
]
}
user_data
=
{
"id"
:
user
.
id
,
"username"
:
user
.
username
,
"email"
:
user
.
email
}
return
success_response
(
data
=
user_data
)
@
user_bp
.
route
(
'/create'
,
methods
=
[
'POST'
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment