Add a plan sync endpoint that recomputes, persists and reports the delta
The calendar is becoming the plan: a user edits a period and the schedule updates immediately, with no separate propose and apply steps. POST /api/plan/sync does both and returns a per-date diff against a snapshot taken before any write, so the interface can say what actually moved rather than guessing from coarse counters. Pinned days now mean something. A day the user hand-edited keeps its type and its parent: the loader hides unpinned wish-attributed rows from the allocator so a re-plan is free to move them, while pinned rows stay visible and the existing occupancy check refuses to touch them. Their cost is debited off the pool before any window is funded, following the precedent already set for preschool planning days. Propose and apply are untouched. The allocator stays pure.
This commit is contained in:
+12
-11
@@ -271,17 +271,6 @@ def get_analytics_service(
|
||||
AnalyticsServiceDep = Annotated[AnalyticsService, Depends(get_analytics_service)]
|
||||
|
||||
|
||||
def get_planning_service(
|
||||
repo: PlannedLeaveRepositoryDep,
|
||||
analytics_service: AnalyticsServiceDep,
|
||||
parental_leave_repo: ParentalLeaveRepositoryDep,
|
||||
) -> PlanningService:
|
||||
return PlanningService(repo, analytics_service, parental_leave_repo)
|
||||
|
||||
|
||||
PlanningServiceDep = Annotated[PlanningService, Depends(get_planning_service)]
|
||||
|
||||
|
||||
def get_allocation_input_loader(
|
||||
workspace_repo: WorkspaceRepositoryDep,
|
||||
child_repo: ChildRepositoryDep,
|
||||
@@ -314,6 +303,18 @@ def get_planning_engine_service(loader: AllocationInputLoaderDep) -> PlanningEng
|
||||
PlanningEngineServiceDep = Annotated[PlanningEngineService, Depends(get_planning_engine_service)]
|
||||
|
||||
|
||||
def get_planning_service(
|
||||
repo: PlannedLeaveRepositoryDep,
|
||||
analytics_service: AnalyticsServiceDep,
|
||||
parental_leave_repo: ParentalLeaveRepositoryDep,
|
||||
planning_engine_service: PlanningEngineServiceDep,
|
||||
) -> PlanningService:
|
||||
return PlanningService(repo, analytics_service, parental_leave_repo, planning_engine_service)
|
||||
|
||||
|
||||
PlanningServiceDep = Annotated[PlanningService, Depends(get_planning_service)]
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Current-user dependency (JWT bearer)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user