Shift Storage
Summary
A Shift is a tenant-owned named work window with schedule and calculation settings plus a compatibility identifier.
Audience
- Backend developers, Time Office administrators, QA engineers, and architects
Reference Content
Persisted shape and lifecycle
Stored concepts include tenant identifiers, name, start/end times, grace minutes, standard hours, overtime threshold category, night-shift indicator, active state, timestamps, and a numeric compatibility identifier. Overnight behavior is confirmed: the domain derives night-shift state when end is at or before start unless explicitly supplied.
The compatibility identifier has a global unique index and is generated for API-created rows; the backfill context can preserve a legacy identifier. The tenant/active index supports active-list queries. Name uniqueness per tenant is checked case-insensitively by application logic, not by a database index.
Deletion is soft: the domain deactivates a Shift because assignments and historical Attendance may reference it. Assignment rows store ShiftId but no database foreign key exists, so referential validation occurs in application commands. No default-shift column is stored on Shift; fallback/default resolution is handled elsewhere.
Source References
microservices/src/attendance-service/Domain/TimeOffice/Shift.csmicroservices/src/attendance-service/Infrastructure/AttendanceDbContext.csmicroservices/src/attendance-service/Application/Services/ShiftPolicyCommands.cs
Related Articles
See Also
Keywords
- Attendance persistence
- EF Core
- PostgreSQL
Revision Information
- Status: Draft
- Last reviewed: 2026-07-15
- Review cycle: Quarterly