Skip to content

Refactor mvc#17

Merged
RedHellier merged 5 commits intomainfrom
refactor-mvc
May 23, 2025
Merged

Refactor mvc#17
RedHellier merged 5 commits intomainfrom
refactor-mvc

Conversation

@arecouz
Copy link
Contributor

@arecouz arecouz commented May 7, 2025

📌 Summary

This pull request refactors the back-end route and folder structure to improve clarity and maintainability. The previous routing setup mixed responsibilities between admin and user functionality, which caused confusion and overlap in the service layers.


🔍 Related Issues / Tickets


📂 What’s Changed (in the back end)

  • Refactored folder and route structure for better separation of concerns

  • Reorganized the following routes:

    • adminRoutes ➜ handles high-level access to users and resources
    • userRoutes ➜ for user-specific operations like updating profiles or viewing public info
    • resourceRoutes ➜ for posting and updating resources (user-driven actions)
    • authRoutes ➜ dedicated to authentication logic
  • Moved createUser from users route into auth route under signup.


🧪 How to Test

  1. Pull this branch
  2. Run npm install
  3. Run npm run dev to start the server
  4. Test routes:

`POST http://localhost:5000/resources
Content-Type: application/json

{
"title": "New Resource Title",
"content": "This is the content of the new resource.",
"created_by": "2fc9e2a7-776c-43ba-bd24-9b863096120b"
}`

`
POST http://localhost:5000/auth/signup
Content-Type: application/json

{
"email": "somethingsomething@gmail.com",
"password": "supersecretpassword69",
"role": "user"
}
`


✅ Checklist

  • Code compiles and server runs
  • Unit and integration tests pass
  • API contract matches the documentation
  • Error handling is appropriate
  • Logging is consistent and secure
  • No hardcoded secrets or credentials
  • Peer-reviewed

🧠 Notes for Reviewers

Please verify:

  • That each route handles only its relevant scope (e.g., user vs. admin vs. auth)
  • That userService and resourceService no longer have mixed concerns
  • That the new structure scales better as the project grows

@RedHellier RedHellier merged commit 20912cb into main May 23, 2025
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.

Refactor backend route structure

2 participants