feature/fix bugs on organization use-cases #174
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚀 Volunchain Pull Request
Mark with an x all the checkboxes that apply (like [x])
[ ] Closes #
[x] Added tests (if necessary)
[x] Run tests
[x] Run formatting
[x] Evidence attached
[x] Commented the code
📌 Type of Change
[ ] Documentation (updates to README, docs, or comments)
[x] Bug fix (non-breaking change which fixes an issue)
[x] Enhancement (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
📝 Changes description
Implemented and validated the full CRUD (Create, Read, Update, Delete) use cases for the Organization module.
This pull request finalizes the Organization module, ensuring all use cases are properly wired, validated, and tested across the stack.
The key changes include:
Finalized Use Cases: All existing use cases (create-organization.usecase.ts, delete-organization.usecase.ts, get-all-organizations.usecase.ts, get-organization-by-id.usecase.ts, update-organization.usecase.ts) have been reviewed, completed, and now expose a clear execute(input) method with explicit error handling.
Input Validation: DTOs (create-organization.dto.ts, update-organization.dto.ts) are now fully integrated with class-validator and class-transformer to provide robust input validation. Validation errors are mapped to a consistent 400 Bad Request response with a structured payload.
Controller and Routing: The organization.controller.ts has been updated to correctly invoke the finalized use cases. All endpoints are wired in src/routes/OrganizationRoutes.ts, with appropriate HTTP status codes for each operation (201 for POST, 200 for GET/PUT, 204 for DELETE).
Repository Alignment: The repository implementation has been verified to align with the organization-repository.interface.ts contract, ensuring all use cases are supported.
Comprehensive Testing: New unit tests have been added for each use case to cover both happy paths and failure modes. Integration tests have also been updated to validate the HTTP layer, with the goal of achieving at least 80% code coverage for the module.
⏰ Time spent breakdown
Reviewing and finalizing use cases: 2 hours
Implementing DTO validation and error mapping: 2 hours
Updating controller and wiring routes: 1 hour
Writing and running tests (unit & integration): 2.5 hours
Code review and final polishing: 0.5 hours
Total time: 8 hours