Files
F-r-ldraledigplannerare/backend/app/models/planned_day_exclusion.py
T
jacobh2 8cfb9c82c6 Let a day removed from a period stay removed
Taking one day out of a period the planner placed did nothing that
lasted: the period still asked for a full week, so the next sync put the
day straight back. The option was disabled rather than lying about it.

A removed day is now recorded as its own thing — no leave for this
parent, this child, this date — and the planner honours it on every
later sync. It is kept apart from the working-day overrides, which
answer a different question about the calendar rather than about the
plan.

The day belongs to the parent whose band was clicked, so removing one
parent's day leaves their partner's alone; where both parents were to be
off on one funding arrangement, the partner is simply funded on their
own instead. A removed day shortens what the period is asking for rather
than counting as a day the plan failed to find, so the advice about
closing a shortfall does not start arguing for a day nobody wants.

Nothing is removed without a way back: the toast undoes it, and the day
itself is marked in the calendar and offers to restore.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ei7gCZzdd751uZtPzb1Pep
2026-09-19 16:05:17 +02:00

43 lines
1.1 KiB
Python

"""API schemas (Pydantic) for PlannedDayExclusion.
Schemas are the API boundary — they validate request bodies and shape
responses, kept separate from the domain entity so the wire format can
evolve independently.
"""
from datetime import date, datetime
from uuid import UUID
from pydantic import BaseModel
from app.entities.planned_day_exclusion import PlannedDayExclusion
class PlannedDayExclusionCreate(BaseModel):
workspace_id: UUID
child_id: UUID
parent_personal_data_uuid: UUID
date: date
class PlannedDayExclusionResponse(BaseModel):
id: UUID
workspace_id: UUID
child_id: UUID
parent_personal_data_uuid: UUID
date: date
created_at: datetime | None
updated_at: datetime | None
@classmethod
def from_entity(cls, entity: PlannedDayExclusion) -> "PlannedDayExclusionResponse":
return cls(
id=entity.id,
workspace_id=entity.workspace_id,
child_id=entity.child_id,
parent_personal_data_uuid=entity.parent_personal_data_uuid,
date=entity.date,
created_at=entity.created_at,
updated_at=entity.updated_at,
)