Work entry audit log (#11)#15
Open
duchacekjan wants to merge 24 commits into
Open
Conversation
No FK to WorkEntry by design — audit survives entry deletion. AuditLog stores denormalized EntryDate, EntryType, WorksheetId for post-delete queries. Closes #2
Right-side Sheet overlay with accordion timeline; colored dot per action, entry type badge, skeleton loading, empty state. Closes #6
History button on every day row; toggle opens/closes right-side sidebar; active button highlighted blue; summary row column aligned. Closes #7
Sheet already renders a close button; removed manual X button. Delete audit now captures all original field values so sidebar shows what the removed entry contained.
…cting line Dots sit in dedicated column left of cards, connected by vertical line. SheetContent gets p-6. Last event has no trailing line segment.
duchacekjan
commented
May 19, 2026
Collaborator
Author
duchacekjan
left a comment
There was a problem hiding this comment.
5 findings total. One bug (EntityId=0 on Create), one risk (nondeterministic batch ordering), one unused variable, one state-reset miss, one weak test assertion.
Includes favicon support, Home route with icon, and dynamic company logo rendering in the AppShell component.
- Back-fill EntityId for Create audit logs via SavedChangesAsync override; SavingChangesAsync fires before EF assigns the auto-increment id - Use DateTime.UtcNow per entry instead of shared timestamp to avoid nondeterministic ordering within a batch - Drop unused callerName variable in audit endpoint handler - Reset expandedIndex when date prop changes in WorkEntryAuditSidebar - Strengthen Audit_PutEntry test to assert changed field names and values Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… sticky properties in WorkSheet
…ead sticky props in WorkSheet
There was a problem hiding this comment.
Pull request overview
Adds end-to-end auditing for WorkEntry mutations (create/update/delete) and surfaces per-day audit history in the worksheet UI via a right-side sidebar, backed by an EF Core SaveChangesInterceptor and a new audit endpoint.
Changes:
- Backend: introduce
AuditLogstorage +AuditInterceptor, and addGET /api/worksheets/{year}/{month}/days/{date}/audit. - Frontend: add TS DTOs, API function + TanStack Query hook, implement
WorkEntryAuditSidebar, and wire a per-day history button intoWorkSheet. - Tests/docs: add integration coverage for interceptor/endpoint, Playwright coverage for sidebar, and update README/CLAUDE.
Reviewed changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| src/UCK26.Ui.Tests/WorkPageTests.cs | Adds Playwright coverage for opening/closing the audit sidebar and empty/non-empty states. |
| src/UCK26.Api/Program.cs | Registers AuditInterceptor and wires it into EF Core via AddInterceptors. |
| src/UCK26.Api/Persistence/Migrations/AppDbContextModelSnapshot.cs | Updates EF snapshot to include AuditLogs. |
| src/UCK26.Api/Persistence/Migrations/20260519060944_AddAuditLog.Designer.cs | Adds migration designer for AuditLogs table. |
| src/UCK26.Api/Persistence/Migrations/20260519060944_AddAuditLog.cs | Creates AuditLogs table (no FK to WorkEntry). |
| src/UCK26.Api/Persistence/AuditLog.cs | Introduces AuditLog, AuditAction, and AuditChangedField. |
| src/UCK26.Api/Persistence/AuditInterceptor.cs | Captures WorkEntry mutations and writes audit rows. |
| src/UCK26.Api/Persistence/AppDbContext.cs | Adds AuditLogs DbSet and a pending-backfill list. |
| src/UCK26.Api/Endpoints/WorksheetEndpoints.cs | Adds the day-scoped audit endpoint and deserializes ChangedFields. |
| src/UCK26.Api.Tests/Integration/WorksheetEndpointTests.cs | Adds integration tests for interceptor behavior and audit endpoint authorization. |
| src/UCK26.Api.Tests/Infrastructure/TestWebApplicationFactory.cs | Ensures the interceptor is applied in the test DbContext configuration. |
| src/uck26-frontend/src/shared/ui/AppShell.tsx | Adds “Home” route and updates sidebar route entries. |
| src/uck26-frontend/src/shared/lib/api/worksheets.contracts.api.ts | Adds audit DTO contracts for frontend consumption. |
| src/uck26-frontend/src/shared/lib/api/worksheets.api.ts | Adds getWorkEntryAudit API call. |
| src/uck26-frontend/src/features/work/worksheets.queries.ts | Adds useWorkEntryAudit query hook. |
| src/uck26-frontend/src/features/work/WorkSheet.tsx | Adds history icon column + mounts WorkEntryAuditSidebar. |
| src/uck26-frontend/src/features/work/WorkEntryAuditSidebar.tsx | Implements the audit history sidebar UI. |
| src/uck26-frontend/package.json | Bumps @itixo/component-library dependency. |
| src/uck26-frontend/package-lock.json | Updates lockfile for the component library bump. |
| README.md | Documents audit logging and the new audit endpoint + entities list. |
| CLAUDE.md | Updates solution map and testing data-test-id conventions for audit UI. |
Files not reviewed (2)
- src/UCK26.Api/Persistence/Migrations/20260519060944_AddAuditLog.Designer.cs: Language not supported
- src/uck26-frontend/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
Author
|
Addressed all unresolved review threads in
Verification:
|
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
AuditLogentity +AuditInterceptor(EF CoreISaveChangesInterceptor) capturing allWorkEntrymutations in the same transactionGET /api/worksheets/{year}/{month}/days/{date}/auditendpoint returning day-scoped history; admin can pass?userIdgetWorkEntryAuditAPI fn, anduseWorkEntryAuditTanStack Query hookWorkEntryAuditSidebar— right-sideSheetoverlay with accordion timeline, colored action dots, entry type badges, skeleton/empty statesWorkSheetday row; toggle opens/closes sidebar; active row button highlighted blueTest plan
dotnet run --project src/UCK26.Api.Tests)npm run lintzero errors (TypeScript strict)dotnet run --project src/UCK26.Ui.TestsCloses
Closes #2
Closes #3
Closes #4
Closes #5
Closes #6
Closes #7
Closes #11