Skip to main content

Employee Audit and Timeline Storage

Summary

Employee timeline entries are aggregate children intended for workforce history. Employee audit logs are separate infrastructure records describing technical changes. Both are tenant-scoped, but only timeline entries have an Employee foreign key.

Audience

  • Backend developers and QA engineers
  • Support engineers and solution architects

Data flow

Timeline versus audit

ConcernTimelineAuditSource
PurposeEmployee lifecycle/history feedTechnical record of entity/action/actorDomain/Employees/Employee.cs, Infrastructure/EmployeeDbContext.cs
RelationshipRequired Employee foreign key; cascade deleteEntity identifier stored as text; no Employee FKEmployeeDbContext.cs
Tenant scopeChild tenant filterAudit query filtersame
ActorActor value stored on each entryActor identity stored on each audit rowsame
DetailDescription, category, optional metadataAction plus optional technical detailsame
RetrievalEmployee and tenant feed repositories, newest firstNo public Employee audit query endpoint foundInfrastructure/Persistence.cs

Timeline retrieval uses no-tracking queries ordered by occurrence time descending. A tenant feed is limited to a bounded maximum in repository code. The timeline has both an Employee foreign-key index and a tenant/occurrence index.

Actor and correlation context

Handlers derive actor identity from request context and fall back to a system actor. The audit and timeline persisted models do not contain a correlation-identifier property. Correlation-to-history persistence is therefore Not implemented in these two objects; outbox records have a separate optional correlation concept.

The source describes audit history as append-only by intent, but the migration does not define a database mechanism that prevents updates or deletes. Database-enforced append-only behavior is Requires confirmation.

Source References

  • microservices/src/employee-service/Domain/Employees/Employee.cs
  • microservices/src/employee-service/Application/Commands/EmployeeApplicationCommands.cs
  • microservices/src/employee-service/Infrastructure/EmployeeDbContext.cs
  • microservices/src/employee-service/Infrastructure/Persistence.cs
  • microservices/src/employee-service/Infrastructure/Migrations/20260701181407_AddTimelineEventFields.cs

See Also

Keywords

  • Employee timeline
  • Technical audit
  • Change history

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-15
  • Review cycle: Quarterly