Skip to main content

Payroll Snapshot Storage

Summary​

A payroll-approved snapshot stores Attendance aggregates for one tenant, employee, month, and year so Payroll-period reads need not depend on changing daily records.

Audience​

  • Backend developers, payroll integrators, QA engineers, and architects

Reference Content​

Persistence behavior​

The snapshot stores period identity, categorized day totals, approved/overtime/shortfall hour totals, an opaque structured breakdown, capture actor, and capture time. Payroll formula internals and payload contents are intentionally excluded.

A unique tenant/employee/month/year index enforces one row per period. Snapshot service behavior replaces the stored aggregate fields when the row already exists and inserts when absent. This is an upsert/replace model, not append-only history.

Attendance Service owns the snapshot; Payroll is the downstream consumer. A Payroll lock client can participate in capture/reopen decisions, but no payroll-run foreign key is modeled. Network calls and broker delivery are outside the database transaction, so cross-service consistency is eventual. Governance for repeated replacement after a frozen run is Requires confirmation beyond the confirmed upsert and lock check.

Source References​

  • microservices/src/attendance-service/Domain/Attendance/PayrollApprovedSnapshot.cs
  • microservices/src/attendance-service/Infrastructure/AttendanceDbContext.cs
  • microservices/src/attendance-service/Application/Services/PayrollSnapshotService.cs
  • microservices/src/attendance-service/Infrastructure/PayrollLockClient.cs

See Also​

Keywords​

  • Attendance persistence
  • EF Core
  • PostgreSQL

Revision Information​

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