Skip to main content

Application Commands, Queries, and Validation

Summary​

Recruitment application handlers coordinate repositories, tenant context, employee integration, audit/timeline writers, and the unit of work. Domain methods enforce lifecycle transitions; handlers enforce record existence and orchestration prerequisites.

Audience​

Backend developers, QA engineers, and support engineers diagnosing lifecycle behavior.

Command responsibilities​

Command areaVerified behavior
Offer acceptanceLoads tenant offer, applies acceptance, persists domain events
Move to onboardingRequires accepted offer and reuses an existing active aggregate
Status updateParses a supported status and applies aggregate transition rules
CompletionInitializes Employee, completes onboarding, marks candidate Joined, commits state/events
Compatibility completionTranslates legacy input/output but does not consume every legacy completion field

Query behavior​

Queries return workspace and onboarding projections scoped through tenant-aware persistence. Joining-report aggregation counts pending, in-progress, completed, cancelled, and login-pending groupings. List sizes are capped by implementation defaults; this documentation does not define a stable API contract or pagination promise.

Validation boundaries​

Validation exists through command checks, status parsing, domain invariants, repository scoping, and downstream Employee Service validators. No dedicated onboarding validator classes were found in the extracted service. Therefore:

  • domain transitions are authoritative for aggregate lifecycle validity;
  • handler existence checks prevent operations on missing related records;
  • compatibility DTO shape does not prove every field is validated or persisted;
  • Employee Service validates the employee record at its own boundary;
  • frontend form checks are usability controls, not server authorization or domain validation.

Completed onboarding is terminal in the extracted aggregate. Error-to-response mapping belongs to the API layer and will be documented in Epic 14.3.

Requires confirmation​

  • Whether query caps and sorting are sufficient for large tenants.
  • Whether richer onboarding input requires explicit validators before compatibility retirement.
  • Standard retry and operator guidance for cross-service completion failures.

Source References​

  • microservices/src/recruitment-service/Application/Commands/OnboardingCommands.cs
  • microservices/src/recruitment-service/Application/Commands/OfferCommands.cs
  • microservices/src/recruitment-service/Application/Queries/RecruitmentQueries.cs
  • microservices/src/recruitment-service/Domain/Recruitment/Onboarding.cs
  • microservices/src/employee-service/Application/Employees/EmployeeCommands.cs

See Also​

Keywords​

  • Command handler
  • Query projection
  • Domain validation

Revision Information​

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