Rework balances around per-parent days left and deduce the partner from FK
Manual entry now takes one parent's sjukpenningnivå, lägstanivå and dubbeldagar left (plus optional reserved days) and derives the rest in build_snapshot, shared with the scraper. The scraper also reads the family panel and exposes a partner deduction; with two parents it is saved as a 'deduced' snapshot (migration 002). Parent count is the single source of entitlement: one member gets 480 days and 96 savable at age 4, two get 240 and 48 each. Workspaces are capped at two parents. Also lands the in-flight squash of migrations 002–011 into the initial schema and the removal of planning_mode. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -46,6 +46,10 @@ class LeaveWishCreate(BaseModel):
|
||||
# bounding range the allocator searches within for the best-costing window.
|
||||
window_mode: str = "fixed" # 'fixed' | 'flexible'
|
||||
|
||||
# §Decision A (co-leave) — opt-in dubbeldagar; see app/entities/leave_wish.py.
|
||||
# Only meaningful when parent_mode == 'both'.
|
||||
wants_dubbeldag: bool = False
|
||||
|
||||
|
||||
class LeaveWishUpdate(BaseModel):
|
||||
"""Partial update — all fields optional; only provided fields are changed."""
|
||||
@@ -78,6 +82,11 @@ class LeaveWishUpdate(BaseModel):
|
||||
|
||||
window_mode: str | None = None # 'fixed' | 'flexible'
|
||||
|
||||
# `None` means "leave unchanged" here too, same as every other field on
|
||||
# this partial-update model -- there is no "clear it back to False" need
|
||||
# (False is already the shape-level default), so no `_clear_*` flag.
|
||||
wants_dubbeldag: bool | None = None
|
||||
|
||||
|
||||
class LeaveWishResponse(BaseModel):
|
||||
id: UUID
|
||||
@@ -103,6 +112,8 @@ class LeaveWishResponse(BaseModel):
|
||||
|
||||
window_mode: str
|
||||
|
||||
wants_dubbeldag: bool
|
||||
|
||||
created_at: datetime | None
|
||||
updated_at: datetime | None
|
||||
|
||||
@@ -127,6 +138,7 @@ class LeaveWishResponse(BaseModel):
|
||||
parent_mode=entity.parent_mode,
|
||||
parent_personal_data_uuid=entity.parent_personal_data_uuid,
|
||||
window_mode=entity.window_mode,
|
||||
wants_dubbeldag=entity.wants_dubbeldag,
|
||||
created_at=entity.created_at,
|
||||
updated_at=entity.updated_at,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user