Repository navigation
feat(api): Star, like and hide an asset through PATCH /assets/{id}/interaction (#46) - #292
Merged
Merged
Conversation
…teraction (#46) The caller's interaction state is written by a Core writer that takes and returns plain records, so the API still never touches AssetInteraction. It checks only VisibleTo, so a hidden asset can be unhidden; an empty change creates no row; and a first write that loses the (UserId, AssetId) unique race reloads and reapplies once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-ups: a bodiless PATCH now returns 200 with the current state instead of 400, as decided for an empty body. The writer's load query is pinned by ToQueryString on Npgsql (VisibleTo and the caller's row, no hidden rule), the index constant is wired with HasDatabaseName like its siblings, and the view mapping reuses the InteractionState overload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-endpoint # Conflicts: # CLAUDE.md
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.
Closes #46. Design note: #46 (comment). Decision (A1 + B1 + C1): #46 (comment)
Summary
Departures from the note:
SaveChangesAsyncitself (on the context, which is theIUnitOfWork). Other Core repositories leave saving to the caller. This one cannot, because the retry has to own both the save andChangeTracker.Clear.EfAssetViewReaderwithOnThisDay, not over HTTP.ResponseContractTestsis unchanged: its reflection scan already covers the reusedAssetInteractionDto.Evidence
PATCH /api/v1/assets/{id}/interactionis not mapped, and no code writesInteractions.After:
MediaEndpointsTests):{}and no body at all → no change,200;userId→ the write is for the caller;404;401without a write.AssetInteractionWriterTests):falseclears one;null;ToQueryString()on Npgsql: one statement withVisibleToand the caller's row, and no hidden-ruleEXISTS.InteractionIndexNames.OnePerUserAndAsset.scripts/mutation-changed.shreports100.00 %.dotnet format --verify-no-changes,scripts/derive-db-docs.sh --checkandhas-pending-model-changesare all clean.Merge Danger
Door: two-way for the code; one-way-ish for the contract
No schema change.
HasDatabaseNamesets the index's existing name, so there is no migration. The route, the body field names and the response shape become a public contract once the UI depends on them.Blast Radius: small
It adds one route. The only existing code touched is the view mapping in
AssetDtoMapper, which now builds itsinteractionobject through the new overload; the output is unchanged and covered by its tests.🤖 Generated with Claude Code