Skip to content

feat: implement sorting and search api with tests and docs#123

Open
Muyideen-js wants to merge 1 commit intoTalenttrust:mainfrom
Muyideen-js:feature/backend-12-sorting-and-search-api
Open

feat: implement sorting and search api with tests and docs#123
Muyideen-js wants to merge 1 commit intoTalenttrust:mainfrom
Muyideen-js:feature/backend-12-sorting-and-search-api

Conversation

@Muyideen-js
Copy link
Copy Markdown

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

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 24, 2026

@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! 🚀

Learn more about application limits

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.

[Mike] 12. Sorting and search API

1 participant