-
-
Notifications
You must be signed in to change notification settings - Fork 319
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
HomeDBManager refactoration: extract method related to Users management in its own module #1049
Conversation
7d3272c
to
36e23d9
Compare
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.
LGTM
Thank you @hexaltation! |
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.
Thank you for wrestling with this beast @fflorent
Thanks @paulfitz! The PR is not merged yet, do you expect something else beforehand? |
Thanks for reminder :) |
…nt in its own module (gristlabs#1049) The HomeDBManager remains the exposed class to the other parts of the code: any module under gen-server/lib/homedb like UsersManager is intended to be used solely by HomeDBManager, and in order to use their methods, an indirection has to be created to pass through HomeDBManager.
…nt in its own module (#1049) The HomeDBManager remains the exposed class to the other parts of the code: any module under gen-server/lib/homedb like UsersManager is intended to be used solely by HomeDBManager, and in order to use their methods, an indirection has to be created to pass through HomeDBManager.
Context
The HomeDBManager module is too big, it has too much responsibilities and it becomes hard to have a global vision of its methods.
Proposed solution
I extracted some methods related to users management and moved them in their own class:
UsersManager
. It's a first step for shrinking HomeDBManager.The HomeDBManager remains the exposed class to the other parts of the code: any module under
gen-server/lib/homedb
like UsersManager is intended to be used solely by HomeDBManager, and in order to use their methods, an indirection has to be created to pass through HomeDBManager.In a later PR, I'll propose to move
HomeDBManager.ts
tohomedb/index.ts
. I prefer deferring in order to remove noise and make small steps instead.How to review?
I don't know whether Github has an option to see line moved across files. I found this trick which uses the
git diff
command:$ git checkout refactor-homedb # or gh pr 1049 $ git diff --color-moved=zebra origin/main HEAD
Source: https://git-scm.com/docs/diff-options#Documentation/diff-options.txt---color-movedltmodegt