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 area | Verified behavior |
|---|---|
| Offer acceptance | Loads tenant offer, applies acceptance, persists domain events |
| Move to onboarding | Requires accepted offer and reuses an existing active aggregate |
| Status update | Parses a supported status and applies aggregate transition rules |
| Completion | Initializes Employee, completes onboarding, marks candidate Joined, commits state/events |
| Compatibility completion | Translates 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.csmicroservices/src/recruitment-service/Application/Commands/OfferCommands.csmicroservices/src/recruitment-service/Application/Queries/RecruitmentQueries.csmicroservices/src/recruitment-service/Domain/Recruitment/Onboarding.csmicroservices/src/employee-service/Application/Employees/EmployeeCommands.cs
Related Articles
See Also
Keywords
- Command handler
- Query projection
- Domain validation
Revision Information
- Status: Draft
- Last reviewed: 2026-07-20
- Review cycle: Quarterly