Skip to main content

Leave Application Layer

Summary

The application layer is implemented as scoped command/query services with DTO mapping, inline validation, ports, and a lightweight result model.

Audience

Backend/frontend developers, QA, architects, and new engineers.

Overview

LeaveCommands coordinates request decisions, balance maintenance, Holiday/weekly-off/type administration, Attendance conflicts, optional Workflow, audit/timeline writes, domain mutation, and saves. LeaveQueries composes lists, approved ranges, balances, calendar/configuration data, timeline, and workspace projections. Mapping is implemented by explicit functions and LINQ projections.

There are no separate command-handler classes or MediatR dispatch. Minimal APIs resolve command/query services directly through DI. Errors use a lightweight result with validation, not-found, conflict, forbidden, and success categories; unexpected failures may still use exceptions.

Domain state and outbox rows commit through the DbContext save. Some workflows perform multiple saves and external calls; transaction scope is local and not distributed. Direct and Workflow-managed approvals are mutually controlled by application state/options.

Source References

  • microservices/src/leave-service/Application/LeaveWorkflows.cs
  • microservices/src/leave-service/Application/Dtos.cs
  • microservices/src/leave-service/Application/Common/Cqrs.cs
  • microservices/src/leave-service/Application/Common/Abstractions.cs

See Also

Keywords

  • Leave Service
  • Leave Application Layer
  • Technical architecture

Revision Information

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