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

TASK: Implement design patterns and refactor code #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mkwmkn
Copy link

@mkwmkn mkwmkn commented Oct 3, 2024

Concerns and Suggestions for the Structure of the Data Source

  1. The data source should include a user ID in the users array. Currently, when a user needs to be deleted, it's done by array index instead of using a unique ID.
  2. Users and roles should be stored in different arrays/tables to improve maintainability.
  3. For enrollments, it's better to have a separate array/table named "enrollments" that stores user IDs and course IDs.

Refactoring and Test Details

  1. Applied the Repository design pattern to implement user and course repositories. The school repository was not implemented as the existing logic for schools is the same as for courses.
  2. The repository interface ensures that the repositories adhere to a common contract of methods.
  3. Created a CommandHelper class to handle commands like creating, updating, and deleting users. It utilizes the repository to persist data.
  4. All constants and help texts are provided in config.php.
  5. Unit tests are organized in the tests/ directory and cover major functions.

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.

1 participant