Merge branch 'vacation-rescue-and-wrap'

Vacation rescue/wrap in allocation_service, new plan models/endpoints,
VacationRescueTip, useRescueDayActions, vacationSwaps util, sv+en i18n,
Dashboard/Calendar wiring.

Conflicts came from main's "day assertions" restructure and the earlier
merges; both intents kept:

- plan.py: both import sets; main's sync-with-wish handler kept next to the
  branch's new /rescue-days/dismiss endpoint; HTTP_422_UNPROCESSABLE_CONTENT
  applied to the branch's code (and a survivor in auth.py).
- Accepting a rescue day now goes through POST /api/day-assertions (an
  ad-hoc 'vacation' assertion, no wish) instead of /plan/apply with an
  `is_pinned` flag that no longer exists: on main a pin IS a day assertion
  (see PlanningService.add_planned_day's docstring), and an assertion is
  what keeps a later sync from retyping the day. useRescueDayActions,
  its tests, VacationRescueTip's tests and the backend integration flow
  follow that contract; applyPlan stays as a client for the live endpoint
  minus the dropped field. The hook also gets the security branch's
  useLatestRequest guard with an unconditionally cleared busy flag.
- Calendar.tsx: `locale` threaded into main's applyWishSyncResult call of
  buildSyncToastMessage (the branch's new parameter); the branch's
  swap-visibility toast tests drive the preset path through syncWithWish,
  which is how main saves a wish now.
- types/api.ts: ProposedDayApplyItem kept (used by applyPlan) without
  isPinned; the Add/UpdatePlannedDayRequest types stay removed as on main.
- fixtures/plan.ts: ResourceShortage import dropped (type removed on main).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T4wjgbVL4HAC5Rdaw75VbV
This commit is contained in:
2026-09-21 07:48:33 +02:00
42 changed files with 5531 additions and 103 deletions
+14
View File
@@ -29,6 +29,7 @@ import type { useChildSettings } from '@/hooks/useChildSettings'
import type { useCalendarDays } from '@/hooks/useCalendarDays'
import type { usePreschoolPlanningDays } from '@/hooks/usePreschoolPlanningDays'
import type { usePreschoolPlanningDaysList } from '@/hooks/usePreschoolPlanningDaysList'
import type { useRescueDayActions } from '@/hooks/useRescueDayActions'
import type { useShowWeekNumbers } from '@/hooks/useCalendarPreferences'
import { makeChild, makePersonalData, makeVacationDays, makeWorkspace, makeParentalLeaveFetch } from './mockData'
import { makeWorkspaceOverview } from './analytics'
@@ -294,6 +295,19 @@ export function makePreschoolPlanningDaysResult(
}
}
export function makeRescueDayActionsResult(
overrides: Partial<ReturnType<typeof useRescueDayActions>> = {},
): ReturnType<typeof useRescueDayActions> {
return {
isLoading: false,
error: null,
acceptDay: vi.fn(),
acceptAll: vi.fn(),
dismiss: vi.fn(),
...overrides,
}
}
export function makePreschoolPlanningDaysListResult(
overrides: Partial<ReturnType<typeof usePreschoolPlanningDaysList>> = {},
): ReturnType<typeof usePreschoolPlanningDaysList> {
+17
View File
@@ -16,6 +16,7 @@ import type {
PoolBalance,
ProposedDay,
Rejection,
RescueDay,
ShortfallRemedy,
SurplusAdvice,
VacationBalance,
@@ -126,6 +127,21 @@ export function makePlanAge4Projection(overrides: Partial<PlanAge4Projection> =
}
}
/** §vacation-rescue — one suggest-only concrete date (see `RescueDay` in
* src/types/entities.ts). Defaults to a date within `makePlanProposal`'s
* implicit current-year assumption for tests that don't care about the
* exact date. */
export function makeRescueDay(overrides: Partial<RescueDay> = {}): RescueDay {
return {
date: '2026-12-28',
parentPersonalDataUuid: 'pd-a',
childId: 'child-1',
year: 2026,
reason: 'vacation_rescue',
...overrides,
}
}
export function makePlanProposal(overrides: Partial<PlanProposal> = {}): PlanProposal {
return {
days: [makeProposedDay()],
@@ -135,6 +151,7 @@ export function makePlanProposal(overrides: Partial<PlanProposal> = {}): PlanPro
vacationBalances: [],
surplusAdvice: [],
age4Projections: [],
rescueDays: [],
...overrides,
}
}