Repository navigation
Record media changes in the audit trail, on the entity they belong to - #8
Merged
Merged
Conversation
MediaAuditParticipant, a DotNetBoost.Media write participant, records each
media change as an audit entry enlisted in the media store's own save:
attach, detach and reorder as an Updated entry on the owner (so a
product's trail shows its images), upload, edit and delete on
("Media", <file id>). IgnoreEntity<MediaFile>() and
IgnoreEntity<MediaAttachment>() keep the raw rows out of the trail.
Tests cover a product image's life in the product and file trails, and a
media write that fails after its entry was enlisted leaving nothing
behind. Docs and documented counts updated.
Needs DotNetBoost.Media's write participants, which arrive in the release
after 1.0.0-preview.2; until then this builds only against local source.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MediaAuditParticipant now writes one Updated entry on the product or
category per media operation: the role as the row (Banner, Gallery), file
names as the values, and the operation in Metadata as JSON
({"media":"Attach|Detach|Replace|Reorder","fileId":...}). A replace is one
entry (old file -> new file), a reorder one entry with the whole order
before and after, and a file delete adds a detach on each owner marked
"reason":"FileDeleted". Upload, edit and delete stay on ("Media", id),
without rows for properties the file never had.
Built on DotNetBoost.Media's one-change-per-operation reporting; needs the
Media release after 1.0.0-preview.2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Deleted entry under ("Media", id) gains one Attachments row naming
every entity the file was still attached to ("Category 4 as banner,
Product 42 as gallery"), so the file's history is complete on its own.
Each owner still gets its detach entry marked "reason":"FileDeleted", so
its history stays accurate too. The row is left out for a file attached
to nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Media changes are all Updated entries on their owner, with the operation
in the entry's metadata ({"media":"Attach|Detach|Replace|Reorder"}). The
audit page now reads that convention and draws a badge beside the action
- Attached, Detached, Replaced, Reordered - in the trail table and in the
entry's details. A detach caused by a file delete shows "Detached" with
its own icon in the table and "Detached, file deleted" on hover and in
the details. Entries without that metadata are drawn as before.
Long metadata now wraps instead of running off the row. Strings in en, ar
and fr; a unit test for reading the metadata and an e2e check for the
badge.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The four DotNetBoost.Media pins move from 1.0.0-preview.2 to the release that adds write participants, which MediaAuditParticipant is built on. Until now this branch built only against the local source. Built and tested with -p:UseLocalDotNetBoost=false against the nuget.org packages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
Media changes now show up in the audit trail where people look for them: an image attached to a product is in that product's history, and a file's own upload, edit and delete are under
("Media", <file id>). Built on DotNetBoost.Media1.0.0-preview.3's write participants (dotnetboost/media#5).Before, Auditing's interceptor recorded Media's raw rows: an attach was a
MediaAttachmententry addressed by the link's own GUID, a soft delete was aMediaFilechange toDeletedAt, and the product's history said nothing.Format
MediaAuditParticipantwrites oneUpdatedentry on the owner per media operation — the role as the row, file names as the values, and the operation in the entry'sMetadata:Banner: — → photo.png{"media":"Attach","fileId":"…"}Banner: photo.png → —{"media":"Detach","fileId":"…"}Banner: photo.png → new.png{"media":"Replace","fileId":"…","previousFileId":"…"}Gallery: a.png, b.png → b.png, a.png{"media":"Reorder"}Upload, edit and delete are
Created,UpdatedandDeletedon("Media", <file id>), with only the properties the file has. A delete also writes a detach on each owner marked"reason":"FileDeleted", and lists those owners on the file's own entry as oneAttachmentsrow.Every entry commits in the media store's own
SaveChanges, so it is saved with its change or not at all; a failure to record fails the media write.IgnoreEntity<MediaFile>()andIgnoreEntity<MediaAttachment>()keep the raw rows out.Dashboard
The audit page reads the
mediametadata and shows the operation as a badge beside the action — Attached, Detached, Replaced, Reordered — in the table and the entry details, in en/ar/fr. Entries without that metadata are drawn as before.Upgrade
The four
DotNetBoost.Media.*pins move from1.0.0-preview.2to1.0.0-preview.3.Tests
-p:UseLocalDotNetBoost=falseagainst the nuget.org packages. New integration tests cover a product image's life in the product and file trails, a replacement and a reorder as one entry each, and a media write that fails after its entry was enlisted leaving nothing behind.README section 9 describes the participant; documented counts are updated.
🤖 Generated with Claude Code