Leave Domain Model
Summary
The domain combines two aggregate roots with configuration/calendar entities, foundation entities, a stateless calculator, and domain events.
Audience
Backend developers, architects, QA, and technical reviewers.
Overview
Aggregate roots are LeaveRequest, LeaveBalance, and the foundation EncashmentRecord. Entities include LeaveType, LeavePolicy, Holiday, WeeklyOff, CarryForwardRecord, EmployeeProfile, and timeline entries. IDs and scalar fields are used rather than explicit value-object types. Statuses are string constants, not language enums.
LeaveDayCalculator is a stateless domain service. Request invariants cover tenant/employee presence, date order, positive calculated days, Pending-only approval/rejection, required rejection reason, and cancellation terminal behavior. Balance invariants normalize components and validate encashment units.
Domain events represent request decisions, balance updates, and encashment. The DbContext maps supported domain events to integration events during save. Audit/timeline behavior is orchestrated by application/infrastructure code rather than the aggregates. Carry forward and encashment are Foundation/Partial.
Source References
microservices/src/leave-service/Domain/Leave/LeaveRequest.csmicroservices/src/leave-service/Domain/Leave/LeaveBalance.csmicroservices/src/leave-service/Domain/Leave/LeaveConfig.csmicroservices/src/leave-service/Domain/Leave/CalendarEntities.csmicroservices/src/leave-service/Domain/Leave/LeaveExtras.cs
Related Articles
See Also
Keywords
- Leave Service
- Leave Domain Model
- Technical architecture
Revision Information
- Status: Draft
- Last reviewed: 2026-07-15
- Review cycle: Quarterly