button-inc / emissions-elt-demo

2 stars 0 forks source link

refactor: middleware functions #229

Open shon-button opened 1 year ago

shon-button commented 1 year ago

Description

Currently, middleware.ts is used to redirect requests based on the authenticated user's jwt and role property. If adopting v13.2 route changes then middleware.ts code would need modifications of the redirects and these modifications might also be an opportunity to benefit from refactoring the large single function into a utility function that can chain multiple middlewares for better organization.

Impact

Description of the current or future impact of this tech debt and the risks associated with leaving this debt unresolved.

Proposed Solution(s)

Solution 1.

🔗 Chain: Implement multiple middlewares for improved organization

📝 Objective: Enhance code organization and maintainability by chaining multiple middlewares. This approach streamlines the request processing flow and ensures a clear separation of concerns.

🛠️ Implementation:

🚀 Benefits: Chaining multiple middlewares facilitates modular development, promotes code reusability, and simplifies maintenance. This approach leads to a well-organized codebase that is easier to understand and extend.

User Story: As a developer working on our web application, I want to chain multiple middlewares to enhance the organization of our request processing flow. This will help improve code maintainability and ensure a clear separation of concerns in our application's middleware handling.

Acceptance Criteria: