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 - 2 :: Refactor Scrims Controller #52

Open
DannyMichaels opened this issue Oct 20, 2021 · 0 comments
Open

BE - 2 :: Refactor Scrims Controller #52

DannyMichaels opened this issue Oct 20, 2021 · 0 comments

Comments

@DannyMichaels
Copy link
Owner

DannyMichaels commented Oct 20, 2021

Refactor

  • So much code with stacked if and else if statements,
  • a-lot of re-used code that could be put in separate reuseable function.
  • a-lot of JavaScript array filtering instead of using mongoose queries.
  • there is a route for player joining and player moving, all of that used to be in one function, but I thought it was messy, but now that they're separate I think it just added a-lot more code.
  • a lot of validation logic handled in the controllers, but should be middleware instead.

tips

instead of javascript.filter, use mongoose operators such as $in, findOne, and find, also instead of recreating an array, you can use $set.

@DannyMichaels DannyMichaels changed the title Refactor Scrims Controller BE-2 - Refactor Scrims Controller Jun 17, 2022
@DannyMichaels DannyMichaels changed the title BE-2 - Refactor Scrims Controller Refactor Scrims Controller Jun 17, 2022
@DannyMichaels DannyMichaels changed the title Refactor Scrims Controller BE - 2 Refactor Scrims Controller Jun 17, 2022
@DannyMichaels DannyMichaels changed the title BE - 2 Refactor Scrims Controller BE - 2 :: Refactor Scrims Controller Jun 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant