Skip to main content

Attendance Aggregate

Summary

Attendance is implemented as related aggregate roots rather than one object containing a punch collection and reopen requests.

Audience

Backend developers, architects, and QA engineers.

Aggregate boundaries

AttendanceRecord owns the canonical daily result for tenant, employee, and date: status, hours, paid units, approval state, and payroll note. Punches and reopen requests reference the same business identity but are separate aggregate roots and persistence transactions. Therefore “punch collection” is conceptual, not an in-memory child collection of AttendanceRecord.

AttendanceRecord creation requires tenant and employee context. Calculation applies non-negative canonical values. Approval recalculates and marks the result approved. Rejection clears the business outcome. Approved reopening applies recalculated requested values. The aggregate raises submitted, approved, rejected, and reopened domain events; punch activity raises its own event.

Application services coordinate cross-aggregate behavior and audit. One unit-of-work commit is the transaction boundary for each application operation; no distributed transaction spans Payroll or broker publication.

Source References

  • microservices/src/attendance-service/Domain/Attendance/AttendanceRecord.cs
  • microservices/src/attendance-service/Domain/Attendance/AttendancePunchRecord.cs
  • microservices/src/attendance-service/Domain/Attendance/AttendanceReopenRequest.cs
  • microservices/src/attendance-service/Domain/Attendance/AttendanceDomainEvents.cs
  • microservices/src/attendance-service/Application/Services/AttendanceCommands.cs

See Also

Keywords

  • Attendance Service
  • Attendance Aggregate

Revision Information

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