-
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
Refactor/contacts controller #116
base: main
Are you sure you want to change the base?
Conversation
β¦tor/contacts-controller
β¦tor/contacts-controller
β¦tor/contacts-controller
β¦d error serializer
β¦erializer for standarized error handling
β¦ORO and Error serializer
end | ||
expect(json[:message]).to include("Contact not found") | ||
expect(json[:status]).to eq(404) | ||
end |
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 honestly think I did the same thing. I used the error serializer for my update method and had to go back and refactor all of my tests, good work.
else | ||
return false | ||
end | ||
end |
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 the helper method checking if a company exists. If a company doesn't exist then that contact won't either since contacts belong to a company.
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 added that to company as a helper method to retrieve a company to return a false if company is not found for the index contacts endpoint, I feel like it belongs there instead of the contacts model due to SRP
Type of Change
Description
Refactor Contacts controller and associated model
Motivation and Context
Refactored needed to adhere to skinny controller, fat model guidelines.
Related Tickets
#58
Screenshots (if appropriate):
Added Test?
Checklist: