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

BE Refactor Contacts Controller to Delegate Business Logic to Models #58

Open
CCirbo opened this issue Dec 19, 2024 · 2 comments · May be fixed by #116
Open

BE Refactor Contacts Controller to Delegate Business Logic to Models #58

CCirbo opened this issue Dec 19, 2024 · 2 comments · May be fixed by #116
Assignees

Comments

@CCirbo
Copy link
Collaborator

CCirbo commented Dec 19, 2024

• Move business logic, such as fetching associated companies and contacts, into model methods to follow the Fat Model, Skinny Controller principle.

• Refactor the ContactsController to focus only on:
• Authenticating users.
• Authorizing resources.
• Formatting responses.

@Crosswolfv1
Copy link
Collaborator

Crosswolfv1 commented Feb 4, 2025

Description

Refactor Contacts controller and associated model

Motivation and Context

Refactored needed to adhere to skinny controller, fat model guidelines.

Screenshots (if appropriate):

Types of changes

  • Code Cleanup (code refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  1. Identify Methods on controller needing to be moved to model
  • Index: Move find by's into relate models i.e looking for a company move to company model
  • Create: Use same find by model method as index
  • Create: create in contact model method to create contacts when company is true potentially combine with create w/o default nil/null company id
  • Show: create model method on contacts to find user and contact
  1. move methods and refactor as needed
  2. Add new model tests
  3. Verify/Fix old tests still pass

@Crosswolfv1 Crosswolfv1 moved this from Todo to In Progress in Tracker CRM Feb 4, 2025
@epintozzi
Copy link
Contributor

Oh interesting I like the approach of using the PR template as a template for breaking down your problem

@Crosswolfv1 Crosswolfv1 moved this from In Progress to Todo in Tracker CRM Feb 6, 2025
@Crosswolfv1 Crosswolfv1 moved this from Todo to In Progress in Tracker CRM Feb 7, 2025
@Crosswolfv1 Crosswolfv1 moved this from In Progress to Ready for Review in Tracker CRM Feb 7, 2025
@Crosswolfv1 Crosswolfv1 linked a pull request Feb 7, 2025 that will close this issue
8 tasks
@Crosswolfv1 Crosswolfv1 linked a pull request Feb 7, 2025 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready for Review
Development

Successfully merging a pull request may close this issue.

3 participants