-
Notifications
You must be signed in to change notification settings - Fork 52
Profile update menu #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nto basic-profile-layout
…nto basic-profile-layout
@@ -11,6 +13,10 @@ class User(Base): | |||
username = Column(String, unique=True) | |||
email = Column(String, unique=True) | |||
password = Column(String) | |||
full_name = Column(String) | |||
description = Column(String, default="Happy new user!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe set the default in a const ?
Also in other files in the PR
async def update_user_email( | ||
request: Request, session=Depends(get_db)): | ||
|
||
user = session.query(User).filter_by(id=1).first() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should add a TODO to replace the id=1
part
async def update_user_fullname( | ||
request: Request, session=Depends(get_db)): | ||
|
||
user = session.query(User).filter_by(id=1).first() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filter always id=1 not by user id?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's still no user verification
schema.md
Outdated
@@ -26,4 +28,6 @@ | |||
├── schema.md | |||
└── tests | |||
├── __init__.py | |||
└── config.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conftest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for paying attention
# Post new data | ||
profile = profile_test_client.post( | ||
'/profile/update_user_fullname', data=new_name_data) | ||
assert profile.status_code == 302 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use from starlette import status
app/routers/profile.py
Outdated
) | ||
|
||
|
||
def get_new_user(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change to "get_placeholder_user"
app/templates/base.html
Outdated
@@ -48,5 +50,16 @@ | |||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js" | |||
integrity="sha512-d9xgZrVZpmmQlfonhQUvTR7lMPtO7NkZMkA0ABN3PHCbKA5nqylQ/yWlFAyY6hYgdF1Qh6nYiuADWwKB4C2WSw==" | |||
crossorigin="anonymous"></script> | |||
<script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please move it to another JS file?
|
||
|
||
async def process_image(image, user): | ||
img = Image.open(io.BytesIO(image)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we somehow close this handler?
app/routers/profile.py
Outdated
session.close() | ||
|
||
url = router.url_path_for("profile") | ||
response = RedirectResponse(url=url, status_code=HTTP_302_FOUND) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can directly return it
app/routers/profile.py
Outdated
|
||
# Save to database | ||
user.avatar = f"{user.username}{PICTURE_EXTENSION}" | ||
print(user.avatar) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the print
Codecov Report
@@ Coverage Diff @@
## develop #71 +/- ##
============================================
+ Coverage 35.41% 98.56% +63.14%
============================================
Files 3 4 +1
Lines 48 139 +91
============================================
+ Hits 17 137 +120
+ Misses 31 2 -29
Continue to review full report at Codecov.
|
Now a user able to: