Skip to content
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

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

Conversation

Crosswolfv1
Copy link
Collaborator

Type of Change

  • styling 🎨
  • refactor πŸ§‘β€πŸ’»

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?

  • Yes 🫑
  • All previous tests still pass πŸ₯³

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • This PR includes a Migration and I have notified the deployment team and PM so they can run the migration after the PR is merged.

end
expect(json[:message]).to include("Contact not found")
expect(json[:status]).to eq(404)
end
Copy link
Collaborator

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
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

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.

BE Refactor Contacts Controller to Delegate Business Logic to Models
2 participants