-
Notifications
You must be signed in to change notification settings - Fork 10
Sourcery Starbot ⭐ refactored dericf/twitter-clone-server-fastapi #13
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -148,10 +148,8 @@ def get_tweets_for_user(db: Session, user_id: int, skip: int = 0, limit: int = 1 | |
| raise HTTPException( | ||
| status_code=status.HTTP_400_BAD_REQUEST, detail="User does not exist") | ||
|
|
||
| # user exists - proceed to return tweets | ||
| tweets = db.query(models.Tweet).filter(models.Tweet.user_id == user_id).order_by( | ||
| return db.query(models.Tweet).filter(models.Tweet.user_id == user_id).order_by( | ||
| models.Tweet.created_at.desc()).limit(limit).all() | ||
| return tweets | ||
|
Comment on lines
-151
to
-154
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
This removes the following comments ( why? ): |
||
|
|
||
|
|
||
| def get_tweets_liked_by_user(db: Session, user_id: int, skip: int = 0, limit: int = 100): | ||
|
|
@@ -390,10 +388,8 @@ def get_all_followers(db: Session, user_id: int): | |
| raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, | ||
| detail="Bad userId. User does not exist.") | ||
|
|
||
| # User is valid - proceed to get all followers | ||
| db_followers = db.query(models.Follows).filter( | ||
| return db.query(models.Follows).filter( | ||
| models.Follows.follows_user_id == user_id).all() | ||
| return db_followers | ||
|
Comment on lines
-393
to
-396
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
This removes the following comments ( why? ): |
||
|
|
||
| ############### | ||
| # Tweet Likes # | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,9 +115,7 @@ def update_user(request_body: schemas.UserUpdateRequestBody, | |
| raise HTTPException( | ||
| status_code=status.HTTP_406_NOT_ACCEPTABLE, detail="Username already exists") | ||
|
|
||
| # Update user attributes | ||
| user = crud.update_user(db, current_user.id, request_body) | ||
| return user | ||
| return crud.update_user(db, current_user.id, request_body) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
This removes the following comments ( why? ): |
||
|
|
||
|
|
||
| @router.delete('/', response_model=schemas.EmptyResponse) | ||
|
|
||
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.
Function
create_access_tokenrefactored with the following changes:inline-immediately-returned-variable)