-
Notifications
You must be signed in to change notification settings - Fork 26
Updated the post routes #73
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
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 add the new check for the post ID in the function that's already there so we don't endup with unnecessary changes in the PR. Also, you can change the return codes in there.
I'll rename this PR as it should be called something like "Update Post Error Handlers and negative checks" or something.
Also, for future reference, put a little description on the purpose of the PR and the main changes/features you added!
.gitignore
Outdated
@@ -5,3 +5,6 @@ tmp/ | |||
|
|||
tests/system_tests/helpers/migrations | |||
images/ | |||
|
|||
|
|||
tests/helpers/migrations |
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.
Add new line here at the end of file
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #73 +/- ##
==========================================
+ Coverage 39.90% 40.49% +0.58%
==========================================
Files 16 16
Lines 807 815 +8
==========================================
+ Hits 322 330 +8
Misses 441 441
Partials 44 44 ☔ View full report in Codecov by Sentry. |
app/post.go
Outdated
|
||
return nil, err | ||
} | ||
|
||
var post_binding common.PostIdBinding |
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.
This should be at the top. This is the code that parses the uri param to the post_binding.Id
.
app/post.go
Outdated
@@ -28,14 +30,29 @@ func mdToHTML(md []byte) []byte { | |||
} | |||
|
|||
func postHandler(c *gin.Context, app_settings common.AppSettings, database database.Database) ([]byte, error) { | |||
|
|||
// Get the post ID from the URL | |||
postIDStr := c.Param("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.
Use the c.ShouldbindUri(...)
code instead of this, that does the integer conversion automatically.
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.
Looks good now
No description provided.