Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new search endpoint to the API by introducing a Find method in the MessagesController, enabling searches by various email criteria. Key changes include:
- A new Find method in MessagesController using search criteria for filtering messages.
- The creation of a SearchMessagesCriteria record in the ApiModel.
- Additional tests in MessagesControllerTests to validate the new search functionality.
Reviewed Changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Rnwood.Smtp4dev/Controllers/MessagesController.cs | Added the Find method with search functionality and new ordering logic |
| Rnwood.Smtp4dev/ApiModel/SearchMessagesCriteria.cs | Introduced a new record to encapsulate search criteria parameters |
| Rnwood.Smtp4dev.Tests/Controllers/MessagesControllerTests.cs | Added tests validating the new Find method and adjusted existing test helper methods |
Files not reviewed (2)
- Rnwood.Smtp4dev/Properties/launchSettings.json: Language not supported
- smtpserver/Rnwood.SmtpServer.Tests/Rnwood.SmtpServer.Tests.csproj: Language not supported
Comments suppressed due to low confidence (2)
Rnwood.Smtp4dev/Controllers/MessagesController.cs:103
- [nitpick] The Find method is used for searching and does not modify any data; consider using [HttpGet] or [HttpPost] (with an appropriate request body binding) to better align with REST conventions.
[HttpPut]
Rnwood.Smtp4dev/Controllers/MessagesController.cs:109
- Dynamically constructing the ordering parameter from a string may lead to runtime issues if an invalid sortColumn is provided. Consider implementing a mapping from allowed sort values to expressions to ensure type safety.
.OrderBy(sortColumn + (sortIsDescending ? " DESC" : ""));
|
Thanks for your contribution here. My only question is why use |
|
Thank you for your contribution to smtp4dev! 🎉 Before we can merge your pull request, we need you to sign our Contributor License Agreement (CLA). 📝 Please read the CLA: Contributor License Agreement ✍️ To sign the CLA, please comment on this PR with exactly: This is a one-time requirement for new contributors. Thank you for your understanding! 🙏 I have read the CLA Document and I hereby sign the CLA Sjennol Kaya seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
Added new method "Find" to the api, now we can search with different criteria (to, subject, content, datefrom).