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
| Concern | Timeline | Audit | Source |
|---|---|---|---|
| Purpose | Employee lifecycle/history feed | Technical record of entity/action/actor | Domain/Employees/Employee.cs, Infrastructure/EmployeeDbContext.cs |
| Relationship | Required Employee foreign key; cascade delete | Entity identifier stored as text; no Employee FK | EmployeeDbContext.cs |
| Tenant scope | Child tenant filter | Audit query filter | same |
| Actor | Actor value stored on each entry | Actor identity stored on each audit row | same |
| Detail | Description, category, optional metadata | Action plus optional technical detail | same |
| Retrieval | Employee and tenant feed repositories, newest first | No public Employee audit query endpoint found | Infrastructure/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.csmicroservices/src/employee-service/Application/Commands/EmployeeApplicationCommands.csmicroservices/src/employee-service/Infrastructure/EmployeeDbContext.csmicroservices/src/employee-service/Infrastructure/Persistence.csmicroservices/src/employee-service/Infrastructure/Migrations/20260701181407_AddTimelineEventFields.cs
Related Articles
See Also
Keywords
- Employee timeline
- Technical audit
- Change history
Revision Information
- Status: Draft
- Last reviewed: 2026-07-15
- Review cycle: Quarterly