Repository navigation
Write once, check by the rows changed, and tidy the shared layers - #38
Merged
Merged
Conversation
Carries the shared changes from CleanMinimalApi. reviews_write uses the review the update returns instead of reading it again, and the version resource is VersionInfo.
Contributor
Build Pipeline✅ Ready to merge. Every stage passed.
Commit |
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.
Summary
Updating or deleting a review no longer checks that the review exists before it writes. The write goes first, and if no rows changed the handler throws not found. That's one trip to the database instead of two, and it closes the gap where another request could slip in between the check and the write. Update now returns the changed review from Application.
The database gets a few sensible defaults in one migration (
AddCollationsAndIndexes):While I was in there, some tidy-ups:
[ForeignKey]and[Required]attributes that repeated the fluent configurationPage<T>.Itemsis now anIReadOnlyList<T>MovieReviewsDatabase, so its connection gets closedvirtualis on every repository methodVersionis nowVersionInfo, so it stops tripping overSystem.Version, and its handler can be testedThe shared layers are the same as LeanMeanCleanApps/CleanMinimalApi#67, with the name swapped.
In the MCP server,
write_reviewuses the review the update hands back instead of reading it again, anddelete_reviewjust sends the command. Same results for the client, one less query.The
data-access-ef-core,database-migrations,errors-and-exceptions,paging,unit-testsandtest-designskills now match the code.Type of change
Shared layers
Checklist
dotnet buildanddotnet testpass locally with no warnings..agents/skills.