feat: implement sorting and search api with tests and docs#123
Open
Muyideen-js wants to merge 1 commit intoTalenttrust:mainfrom
Open
feat: implement sorting and search api with tests and docs#123Muyideen-js wants to merge 1 commit intoTalenttrust:mainfrom
Muyideen-js wants to merge 1 commit intoTalenttrust:mainfrom
Conversation
|
@Muyideen-js Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #62
This PR implements secure server-side sorting and keyword search for the TalentTrust-Backend resources, starting with the contracts endpoint.
Key Changes
Core Utilities: Added searchItems (keyword search) and sortItems (secure sorting with field validation) in src/utils/.
API Integration: Updated GET /api/v1/contracts to support search, sortBy, and order query parameters.
Improved Testability: Separated application logic from the server listener by moving the listener to src/server.ts and exporting app from src/index.ts.
Sample Data: Added comprehensive sample data in src/data/contracts.ts for testing and demonstration.
Documentation: Added technical documentation in docs/backend/sorting-and-search.md and updated README.md.
Testing and Coverage
Achieved 100% coverage for Statements, Branches, Functions, and Lines in all new/modified modules.
Added comprehensive unit tests for utilities and integration tests for the API endpoint.
How to Verify
Run npm test -- --coverage to see the full test report.
Start the server with npm run dev and test the endpoints:
GET /api/v1/contracts?search=website
GET /api/v1/contracts?sortBy=value&order=desc