Skip to main content

Expense Projection Storage

Summary​

Payroll-local approved-expense projection persistence.

Audience​

Payroll developers, QA and support engineers, solution and security architects, and implementation partners.

Reference Content​

The sections below describe the confirmed logical storage contract and its implementation boundaries.

Purpose​

Describe ApprovedExpenseSnapshot, the local expense input consumed by Payroll.

Ownership​

Payroll owns the projection; Expense remains authoritative for expense claims and approval state.

Lifecycle​

Inbound events and backfill upsert claim projections. Development seeding supplies local-only verification cases. Event markers protect against duplicate and stale updates.

Persisted fields​

High-level groups include tenant/employee/claim identity, period, approval timing, reimbursable outcome, category/description, status, event markers, and update time. No employee data or payroll values are published here.

Relationships​

Employee and claim identifiers are logical; no database foreign keys are configured.

Constraints​

Claim identity is unique within a tenant.

Indexes​

A unique tenant/claim index supports idempotent projection, and a non-unique tenant/employee/year/month index supports Payroll period consumption.

Tenant behavior​

The projection has a global filter. Event and backfill upserts add explicit tenant scope where filters are bypassed.

Audit behavior​

Projection synchronization/backfill produces Payroll audit evidence; it is not the source approval audit trail.

Integration usage​

The Payroll consumer records the projection, processed-event marker, and audit evidence in one local save before broker acknowledgement.

Known limitations​

Projection state can lag its upstream source; no database relationship validates employee identity.

Requires confirmation​

  • Reconciliation behavior for claim corrections after Payroll consumption.
  • Retention policy for descriptive projection attributes.

Source References​

  • microservices/src/payroll-service/Infrastructure/PayrollDbContext.cs
  • microservices/src/payroll-service/Domain/PayrollEntities.cs
  • microservices/src/payroll-service/Infrastructure/Migrations/PayrollDbContextModelSnapshot.cs
  • microservices/src/payroll-service/Messaging/PayrollReadModelConsumer.cs
  • microservices/src/payroll-service/Backfill/ApprovedExpenseBackfill.cs
  • microservices/src/payroll-service/Infrastructure/Migrations/20260703103304_AddApprovedExpenseSnapshot.cs

See Also​

Keywords​

  • Payroll database
  • Expense Projection Storage
  • Payroll persistence

Revision Information​

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