Description:
The register and login controllers currently work fine, but they contain repeated logic such as:
- Input normalization (trimming and lowercasing strings).
- Building the user response object.
- Handling repeated validation patterns.
This repetition makes the code harder to maintain and more error-prone when future changes are needed (e.g., updating the response structure).
Expected improvement:
- Reduce duplication in the auth controller.
- Improve readability and maintainability.
- Keep functionality, validation, and API responses exactly the same.
Description:
The register and login controllers currently work fine, but they contain repeated logic such as:
This repetition makes the code harder to maintain and more error-prone when future changes are needed (e.g., updating the response structure).
Expected improvement: