Leave Request Storage
Summary
LeaveRequests stores the LeaveRequest aggregate, its tenant/employee reference, calculated units, lifecycle state, decision metadata, timestamps, and optional Workflow correlation.
Audience
Backend developers, QA engineers, architects, and support engineers.
Reference Content
| Storage area | Confirmed fields or behavior | Enforcement | Source |
|---|---|---|---|
| Identity/scope | Integer identity, tenant identifier, labor reference | Primary key and tenant filter | microservices/src/leave-service/Infrastructure/LeaveDbContext.cs |
| Request terms | Type, calculated days, date range, optional reason | Required/length/precision mapping; calculation is application/domain behavior | microservices/src/leave-service/Domain/Leave/LeaveRequest.cs |
| Lifecycle | Status, rejection reason, approver, approval time | State transitions are domain-enforced, not database checks | microservices/src/leave-service/Domain/Leave/LeaveRequest.cs |
| Creation/change | Creator, created time, updated time | Persisted columns | microservices/src/leave-service/Infrastructure/Migrations/LeaveDbContextModelSnapshot.cs |
| Workflow | Optional workflow instance identifier | Non-unique index; no Workflow FK | microservices/src/leave-service/Infrastructure/LeaveDbContext.cs |
The diagram shows logical relationships only: the current migration snapshot defines no foreign keys. Indexes support tenant/employee/from-date, tenant/status, and Workflow lookup. There is no database uniqueness constraint preventing overlapping requests; approved-overlap detection is an application query. Cancellation changes status rather than deleting through the extracted command, and approval/cancellation balance effects are saved in a later unit-of-work call, so request state and balance state are not one atomic database transaction.
Source References
- microservices/src/leave-service/Domain/Leave/LeaveRequest.cs
- microservices/src/leave-service/Infrastructure/LeaveDbContext.cs
- microservices/src/leave-service/Infrastructure/Migrations/LeaveDbContextModelSnapshot.cs
- microservices/src/leave-service/Application/LeaveWorkflows.cs
Related Articles
See Also
Keywords
- LeaveRequest
- Workflow correlation
- Lifecycle persistence
Revision Information
- Status: Draft
- Last reviewed: 2026-07-15
- Review cycle: Quarterly