add patch, delete, get methods#5
Open
gelono wants to merge 2 commits into
Open
Conversation
p1v2
reviewed
May 16, 2023
| item = session.query(Book).filter(Book.id == book_id).first() | ||
| except SQLAlchemyError as e: | ||
| print(e) | ||
| return {"message": "error while working with database"} |
Owner
There was a problem hiding this comment.
pls return response with the correct HTTP status here.
p1v2
reviewed
May 16, 2023
| return BookModel.from_orm(item) | ||
| else: | ||
| raise HTTPException( | ||
| status_code=status.HTTP_204_NO_CONTENT, |
Owner
There was a problem hiding this comment.
404 should be returned there. 204 is HTTP status code for the successful deletion
p1v2
reviewed
May 16, 2023
| ) | ||
|
|
||
|
|
||
| @router.delete("/{book_id}", response_model=BookModel, status_code=200) |
Author
|
I did a fix and commit to my repo. Should I need to do the new PR? |
Owner
|
No, I'll check the existing one.
вт, 16 трав. 2023 р. о 12:06 gelono ***@***.***> пише:
… I did a fix and commit to my repo. Should I need to do the new PR?
—
Reply to this email directly, view it on GitHub
<#5 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADDHH52BU7G6MA2523UABCTXGM7RXANCNFSM6AAAAAAYDJ4Q3U>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Home work 10. Zadniprovskyi Oleg