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

chore: refactor account model #3570

Merged
merged 34 commits into from
Feb 13, 2020
Merged

chore: refactor account model #3570

merged 34 commits into from
Feb 13, 2020

Conversation

djaiss
Copy link
Member

@djaiss djaiss commented Feb 8, 2020

This PR refactors the Account model.

The main goals are:

  • models should have the least amount of logic possible. They should mainly be used to have setters/getters. If there is a logic, it should be placed in a service instead.
  • a service should be used when the object is changed (create/edit/delete)
  • models should be as small as possible.
  • helpers should be used whenever there is a logic that we should know about but that doesn't change the object itself.

Here are all the changes:

  • move the canDowngrade method to a new helper (Account Helper)
  • remove the timezone() method that was not used anywhere
  • move the getStorageSize() method to a new StorageHelper helper
  • move hasReachedAccountStorageLimit() method to the StorageHelper helper
  • move yearly statistics methods to AccountHelper helper
  • move the hasLimitations() method to AccountHelper
  • move accountHasLimitations method to AccountHelper
  • move getRemindersForMonth() to AccountHelper
  • move replaceGender to GenderHelper
  • move defaultGender() method to AccountHelper
  • move hasAny() method to InstanceHelper helper

@djaiss djaiss requested a review from asbiin February 8, 2020 23:22
@djaiss
Copy link
Member Author

djaiss commented Feb 12, 2020

@asbiin it was a really bad idea from me to submit a big PR like that. There are too many changes. It’s the last time.

Copy link
Member

@asbiin asbiin left a comment

Choose a reason for hiding this comment

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

Great work! That will make Account model lighter!

djaiss and others added 3 commits February 12, 2020 19:29
…de.php

Co-Authored-By: Alexis Saettler <alexis@saettler.org>
…de.php

Co-Authored-By: Alexis Saettler <alexis@saettler.org>
@djaiss
Copy link
Member Author

djaiss commented Feb 13, 2020

Changes made. Final check!

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

83.8% 83.8% Coverage
0.0% 0.0% Duplication

@djaiss djaiss merged commit 5bf2626 into master Feb 13, 2020
@djaiss djaiss deleted the 2020-02-08-refactor-account branch February 13, 2020 15:48
@github-actions
Copy link

This pull request has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants