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

Consider extracting user-related API operations from AdminApiHandler #380

Open
ssciolla opened this issue Apr 6, 2022 · 0 comments
Open
Labels
API back end Involves changes to the Express application or other server-related files enhancement New feature or request good first issue Good for newcomers

Comments

@ssciolla
Copy link
Contributor

ssciolla commented Apr 6, 2022

I'm not entirely sure this is necessary, but there is some awkwardness with the current implementation that I wanted to document.

AdminApiHandler has some constructor parameters and instance variables that are not used by all methods. For instance, userLoginId is not used by AdminApiHandler.createExternalUsers, but is by AdminApiHandler.getParentAccounts. This leads to a situation where we have to provide defaults even when they are not used. This is likely best resolved by extracting some of the methods into a separate class, although there shouldn't be an issue with the current implementation so long as methods are used properly (i.e. defaults aren't relied upon when they should be set). Alternatively, constructor parameters could become method parameters.

I originally envisioned the handler organization as being one class per Canvas API root (i.e. courses, sections, accounts), but the inclusion of AdminApiHandler.getUserInfo somewhat violates that (users root). However, createExternalUser does use accounts, and I'd probably try to keep createExternalUser with getUserInfo since they are related conceptually. I could see moving both to a new UserApiHandler class, but I'm open to other ideas.

@ssciolla ssciolla added enhancement New feature or request back end Involves changes to the Express application or other server-related files API labels Apr 6, 2022
@ssciolla ssciolla added the good first issue Good for newcomers label Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API back end Involves changes to the Express application or other server-related files enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant