Repository navigation
Write once, check by the rows changed, and serve the lists over an HTTP API - #37
Merged
Merged
Conversation
Carries the shared changes from CleanMinimalApi.
HttpGetMovies, HttpGetAuthors and HttpGetReviews answer GET /movies, /authors and /reviews from the query string, with 200 and the page or 400 problem details. The direct functions are unchanged.
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.
The lists also come over HTTP now.
HttpGetMovies,HttpGetAuthorsandHttpGetReviewssit behind an API Gateway HTTP API atGET /movies,GET /authorsandGET /reviews, readingquery,offset,limit,movieIdandauthorIdfrom the query string. They answer200with the same page JSON as the direct functions, or400withapplication/problem+jsonwhen the request doesn't add up. Anything else fails the invocation and API Gateway answers500. HTTP APIs are the cheaper option AWS points to when you don't need REST API-only features. The direct functions haven't changed, and the stack prints the API's address asApiUrl.A couple of Lambda Annotations quirks shaped it:
stringand are parsed, with a400for anything that isn't a GUID[HttpApi]methods carry a doc link to our method that can't resolve, soPresentation.csprojhasCS1574inNoWarn, with a comment saying why. A nested.editorconfigdoesn't reach generated files. Theexpose-a-use-caseskill records it as our one suppressionThe
data-access-ef-core,database-migrations,errors-and-exceptions,paging,unit-tests,test-design,api-conventions,expose-a-use-case,json-serialization,presentation-integration-testsandlambda-emulatorskills now match the code, and the README anddocs/RUN.mdshow how to call the routes.Type of change
Shared layers
Checklist
dotnet buildanddotnet testpass locally with no warnings..agents/skills.