Track preschool planning days, partner invites and real vacation forfeiture

Three strands of work that grew together across the same settings screen and
API client, so they land as one change.

Per-year preschool planning days ("studiedagar"): new table, repository
(SQLite + Postgres), service, router and migration 007, plus the hooks and
Settings UI to plan and record them per child and year. Allocation now
reserves the recorded figure for a year where one exists and only falls back
to the child-level estimate otherwise, marking that fallback as assumed.

Partner invitations: workspaces issue and list invitations, registration
accepts an invite token to join the inviter's workspace instead of creating a
personal one, and a /join/:token page plus the settings invite panel drive it.

Vacation forfeiture: tips and the dashboard now distinguish days a parent
genuinely loses from days that merely age, so the warning stops firing on
balances that were never at risk.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-20 11:22:07 +02:00
parent 6904961bb4
commit 0e9b20ec37
88 changed files with 5301 additions and 348 deletions
@@ -192,10 +192,27 @@ class TestSyncChangeKinds:
) -> None:
ws, child = seeded_ids.workspace_id, seeded_ids.child_id
# An hourly-salaried parent prefers FP (sjukpenning first) over
# vacation for tier-3 interior days, so this is deterministic
# regardless of any assumed vacation default.
# vacation for tier-3 interior days -- UNLESS §Task 2's
# vacation-forfeiture bias overrides that for a year where vacation
# would otherwise be lost. With no `vacation_days` row entered, the
# loader defaults this parent's 2027 entitlement to the statutory
# 25 days and, since nothing has been used yet, `AnalyticsService.
# _vacation_year_series` forecasts most of it as forfeited (the
# `min_vacation_days_per_year` floor caps how much can be banked)
# -- which would make this test's own assertions about sjukpenning
# flakily depend on the forfeiture bias instead of the FP-pool
# fallback it's meant to isolate. `min_vacation_days_per_year=0`
# means the ENTIRE entitlement is bankable, so the simulation
# forecasts zero forfeiture and this parent is deterministically
# FP-first, exactly like before §Task 2.
parent = await personal_data_repo.create(
PersonalData(uuid=uuid4(), workspace_id=ws, name="Hourly Parent", salary_type="hourly")
PersonalData(
uuid=uuid4(),
workspace_id=ws,
name="Hourly Parent",
salary_type="hourly",
min_vacation_days_per_year=0,
)
)
# `parent_mode="specific"` -- with a second (seeded) parent now also
# in the workspace, an "either" wish would default to whichever