Skip to main content

Shift Assignment Storage

Summary

Employee Shift assignments bind an external employee reference to an Attendance-owned Shift over an inclusive effective-date range.

Audience

  • Backend developers, Time Office implementers, QA engineers, and architects

Reference Content

Confirmed behavior

Assignments store tenant identity, employee/labor reference, optional compatibility user reference, Shift identifier, inclusive effective-from and optional effective-to dates, active state, and timestamps. Null end date means open-ended.

Indexes support tenant/employee/effective-start resolution and tenant/Shift lookup. The resolver selects active assignments covering the target date, preferring the latest effective start and identifier. Commands validate that the Shift exists and reject overlaps by reading active assignments and invoking domain range comparison.

Overlap prevention and Shift referential integrity are application-only rules: there is no exclusion constraint, unique range constraint, navigation, or database foreign key. Historical behavior is retained through effective ranges and deactivation. EndOn closes an assignment; physical delete behavior is Requires confirmation because no deletion command is confirmed.

Source References

  • microservices/src/attendance-service/Domain/TimeOffice/EmployeeShiftAssignment.cs
  • microservices/src/attendance-service/Infrastructure/AttendanceDbContext.cs
  • microservices/src/attendance-service/Infrastructure/Persistence.cs
  • microservices/src/attendance-service/Application/Services/ShiftPolicyCommands.cs
  • microservices/src/attendance-service/Application/Services/AttendancePolicyResolver.cs

See Also

Keywords

  • Attendance persistence
  • EF Core
  • PostgreSQL

Revision Information

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