Skip to content

feat: add search and paging queries to the Application layer - #19

Merged
stphnwlsh merged 3 commits into
mainfrom
feature/search-and-paging
Oct 28, 2026
Merged

stphnwlsh merged 3 commits into
mainfrom
feature/search-and-paging

Conversation

@stphnwlsh

@stphnwlsh stphnwlsh commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds search and paging to the shared Application and Infrastructure layers, identically in all five templates. The MCP server needs it so agents can find a movie or author without pulling the whole catalogue, and the APIs can pick it up the same way.

  • SearchMoviesQuery matches a case-insensitive term in the title. SearchAuthorsQuery matches the first name, last name or full name. SearchReviewsQuery filters by movie, by author, or both.
  • Each one returns a Page<T> with the items, the total count and an opaque NextCursor, which is null on the last page. Limits run from 1 to 50 and default to 10.
  • Paging holds the limits and the cursor encoding, and PagingValidatorExtensions keeps the limit, cursor and search-term rules the same for every search. An invalid cursor fails validation with a message that says how to get a valid one.
  • The repository orders results by title, by last and first name, and by movie then author, with the id as a tie-break, so pages are stable.
  • Unit tests cover the handlers, validators and cursor handling. Integration tests cover matching, ordering and paging against the in-memory database.

Nothing in this template's Presentation layer calls the new queries yet. The MCP template's tools move onto them next.

Related issues

None.

Type of change

  • Bug fix
  • New feature
  • Breaking change (the generated solution or template parameters change in a way existing users will notice)
  • Refactoring or clean-up
  • Documentation
  • Build, pipeline or dependency update

Shared layers

  • This only touches the Presentation layer of this template.
  • This touches the Application or Infrastructure layers, tests, pipeline or repository setup, so it needs to be carried across all five templates.

The same change is open in CleanMinimalApi, CleanWebApi, CleanGraphQLApi, CleanLamdaFunction and CleanModelContextProtocol on feature/search-and-paging.

Checklist

  • dotnet build and dotnet test pass locally with no warnings.
  • I added or updated tests, and coverage stays at or above 95%.
  • I updated the README or docs where behaviour changed.
  • I checked the template still installs and creates a working solution (see CONTRIBUTING.md).

SearchMovies, SearchAuthors and SearchReviews return one page of results
with a total count and an opaque cursor for the next page. Movies and
authors match a case-insensitive search term, and reviews filter by
movie and author. Limits run from 1 to 50 with a default of 10, and
invalid cursors fail validation with a message that explains how to
get a valid one.
@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.78%. Comparing base (7e2100c) to head (7615c60).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #19      +/-   ##
==========================================
+ Coverage   99.72%   99.78%   +0.06%     
==========================================
  Files          43       55      +12     
  Lines         360      466     +106     
  Branches       13       20       +7     
==========================================
+ Hits          359      465     +106     
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stphnwlsh
stphnwlsh merged commit e7bfb4f into main Oct 28, 2026
12 checks passed
@stphnwlsh
stphnwlsh deleted the feature/search-and-paging branch October 28, 2026 16:56
stphnwlsh added a commit that referenced this pull request Oct 28, 2026
## Summary

The ten CRUD tools become six tools shaped around what someone asks an
agent to do: find a movie, see what people thought of it, and write or
remove a review.

| Tool | Replaces | What it does |
| --- | --- | --- |
| `movies_search` | `movies_list` | Title search, 10 per page with a
cursor, each with review count and average stars |
| `movies_get` | `movies_get` | One movie with every review and each
author's name |
| `authors_search` | `authors_list`, `authors_get` | Name search (first,
last or full), with review count and average stars |
| `reviews_list` | `reviews_list`, `reviews_get` | Filter by movie,
author or both, or fetch one review by id |
| `reviews_write` | `reviews_create`, `reviews_update` | Creates a
review, or replaces one when given its `reviewId` |
| `reviews_delete` | `reviews_delete` | Unchanged |

- Results are small by default. A first `movies_search` call is about 3
KB on the wire, where `GetAllMovies` returned about 70 KB. Nested
reviews only come back when `includeReviews` is true or from
`movies_get`.
- New Presentation models (`MovieResult`, `AuthorResult`,
`ReviewResult`, `ResultPage<T>`) put movie titles and author names next
to their ids, and every property carries a description that shows up in
the output schema.
- The server instructions describe the new flow: search by name first,
follow `nextCursor` instead of raising the limit, and confirm before
deleting.
- Not-found errors now point at `movies_search`, `authors_search` and
`reviews_list`.
- `server_get_version` stays as a tool for now and moves to a resource
in the next PR.

This is built on #17, #18 and #19, so their commits will drop out of the
diff as they merge.

## Related issues

None.

## Type of change

- [ ] Bug fix
- [x] New feature
- [x] Breaking change (the generated solution or template parameters
change in a way existing users will notice)
- [ ] Refactoring or clean-up
- [x] Documentation
- [ ] Build, pipeline or dependency update

The tool names, arguments and results all change.

## Shared layers

- [x] This only touches the Presentation layer of this template.
- [ ] This touches the Application or Infrastructure layers, tests,
pipeline or repository setup, so it needs to be carried across all five
templates.

## Checklist

- [x] `dotnet build` and `dotnet test` pass locally with no warnings.
- [x] I added or updated tests, and coverage stays at or above 95%.
- [x] I updated the README or docs where behaviour changed.
- [ ] I checked the template still installs and creates a working
solution (see CONTRIBUTING.md).
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.

2 participants