Skip to content

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

Merged
merged 18 commits into from
Apr 2, 2024
Merged

Conversation

SourabHere
Copy link
Contributor

No description provided.

@matheusgomes28 matheusgomes28 self-requested a review March 30, 2024 10:30
Copy link
Owner

@matheusgomes28 matheusgomes28 left a 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
Copy link
Owner

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

Copy link

codecov bot commented Mar 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 40.49%. Comparing base (e28a20d) to head (09bcf4a).

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.
📢 Have feedback on the report? Share it here.

app/post.go Outdated

return nil, err
}

var post_binding common.PostIdBinding
Copy link
Owner

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")
Copy link
Owner

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.

Copy link
Owner

@matheusgomes28 matheusgomes28 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now

@matheusgomes28 matheusgomes28 merged commit c96b703 into matheusgomes28:main Apr 2, 2024
AlDu2407 pushed a commit to AlDu2407/urchin that referenced this pull request Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants