feat(application): extract entitlement use-cases from API router layer

Move core entitlement business logic (syncEntitlement, balance reading,
year summary, set/bulk-set) into packages/application/src/use-cases/entitlement/
using the deps-injection pattern. Audit logging stays in the router support
file; authorization check for getBalance/getBalanceDetail stays in the router
layer. The router support file becomes a thin wiring adapter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-09 20:14:35 +02:00
parent d3bfa8ca98
commit 999626cf70
6 changed files with 966 additions and 677 deletions
+49
View File
@@ -6,6 +6,7 @@ export { updateDemandRequirement } from "./use-cases/allocation/update-demand-re
export {
createAssignment,
createAssignmentFragment,
type AssignmentWithRelations,
} from "./use-cases/allocation/create-assignment.js";
export { updateAssignment } from "./use-cases/allocation/update-assignment.js";
@@ -120,6 +121,54 @@ export {
type RecomputeResourceValueScoresInput,
} from "./use-cases/resource/index.js";
export {
approveVacation,
batchApproveVacations,
rejectVacation,
batchRejectVacations,
cancelVacation,
type ApproveVacationInput,
type ApproveVacationResult,
type ApproveVacationDeps,
type BatchApproveVacationInput,
type BatchApproveVacationResult,
type BatchApproveVacationDeps,
type VacationChargeableInput,
type RejectVacationInput,
type RejectVacationResult,
type RejectVacationDeps,
type BatchRejectVacationInput,
type BatchRejectVacationResult,
type BatchRejectVacationDeps,
type CancelVacationInput,
type CancelVacationResult,
type CancelVacationDeps,
} from "./use-cases/vacation/index.js";
export {
syncEntitlement,
getEntitlementBalance,
getEntitlementBalanceDetail,
getEntitlementSync,
getEntitlementYearSummary,
getEntitlementYearSummaryDetail,
setEntitlement,
bulkSetEntitlements,
type EntitlementSnapshot,
type ResourceHolidayContext,
type SyncEntitlementDeps,
type ReadEntitlementBalanceDeps,
type EntitlementBalanceInput,
type EntitlementBalanceResult,
type EntitlementYearSummaryInput,
type EntitlementYearSummaryDetailInput,
type EntitlementYearSummaryRow,
type SetEntitlementInput,
type SetEntitlementReturn,
type BulkSetEntitlementsInput,
type BulkSetEntitlementsResult,
} from "./use-cases/entitlement/index.js";
export {
calculateEffectiveAllocationCostCents,
calculateEffectiveAllocationHours,