-
Notifications
You must be signed in to change notification settings - Fork 0
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
BE ContactsController #show #73
Conversation
@@ -46,6 +46,25 @@ def create | |||
end | |||
end | |||
|
|||
def show | |||
if params[:id].blank? | |||
render json: ErrorSerializer.format_error(ErrorMessage.new("Contact ID is missing", 400)), status: :bad_request |
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.
I like how youβre using ErrorSerializer to handle errorsβkeeps the responses consistent and user-friendly.
@@ -0,0 +1,73 @@ | |||
require "rails_helper" |
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.
Great job on the tests here. Youβve covered both happy and sad paths well, especially with cases for missing, invalid, and expired tokens.
@@ -697,6 +697,43 @@ raw json body with all fields: | |||
] | |||
}, | |||
``` | |||
#### Show a Contact that belongs to a User (not company contact) |
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.
The README update is super clear and helpful. The sample request and response are a great addition for anyone using this endpoint and makes it clear what route and endpoint you are using.
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 are making this look like clockwork. Everything is nice and tidy! Great use of the serializers and thorough testing.
Type of Change
Description
By adding, in routes.rb,
:show
to the:users
(not:companies
) nested:contacts
resource and adding corresponding #show action to ContactsController, the FE can now access and render a users individual contacts. This is fully tested in Postman and green in RSpec.Motivation and Context
Issue #17 was affected by a prior refactor of the BE ContactsController that removed the #show action because of how the routes are now being nested. While building my ShowContact component on the FE, I was getting a mystery 500 error which led me to see that BE's main had been refactored.
Related Tickets
closes #66
Screenshots (if appropriate):
Added Test?
Checklist: