diff --git a/backend/alembic.ini b/backend/alembic.ini index 24512a0..a4d0f3f 100644 --- a/backend/alembic.ini +++ b/backend/alembic.ini @@ -1,7 +1,7 @@ [alembic] script_location = migrations prepend_sys_path = . -version_path_separator = os +path_separator = os # Last-resort fallback only. migrations/env.py's _resolve_url() overrides this # from the app's own APP_SQLITE_PATH setting (or an `-x sqlalchemy.url=...` # argument) whenever either is available — this value is used only if neither is. diff --git a/backend/app/routers/auth.py b/backend/app/routers/auth.py index 0cca4da..74be6b9 100644 --- a/backend/app/routers/auth.py +++ b/backend/app/routers/auth.py @@ -116,7 +116,7 @@ async def get_context( """Return workspace + children for the current user. Used by the dev harness.""" pd = await pd_repo.get_by_id(current_user.personal_data_uuid) if pd is None: - raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, "No parent profile found") + raise HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, "No parent profile found") children = await child_repo.list_by_workspace(pd.workspace_id) return _UserContext( personal_data_uuid=str(pd.uuid), diff --git a/backend/app/routers/calendar.py b/backend/app/routers/calendar.py index 2533df5..6a9bc73 100644 --- a/backend/app/routers/calendar.py +++ b/backend/app/routers/calendar.py @@ -31,5 +31,5 @@ async def get_calendar_days( workspace_id=workspace_id, start_year=start_year, years=years ) except ValidationError as exc: - raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, str(exc)) from exc + raise HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, str(exc)) from exc return CalendarDaysResponse.from_domain(window) diff --git a/backend/app/routers/day_overrides.py b/backend/app/routers/day_overrides.py index de3a9cc..30eae7f 100644 --- a/backend/app/routers/day_overrides.py +++ b/backend/app/routers/day_overrides.py @@ -28,7 +28,7 @@ async def upsert_day_override( note=payload.note, ) except ValidationError as exc: - raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, str(exc)) from exc + raise HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, str(exc)) from exc return DayOverrideResponse.from_entity(entity) diff --git a/backend/app/routers/fetch_data.py b/backend/app/routers/fetch_data.py index 6986c3e..c42b03b 100644 --- a/backend/app/routers/fetch_data.py +++ b/backend/app/routers/fetch_data.py @@ -82,7 +82,7 @@ async def save_manual_entry( source=payload.source, ) except ValidationError as exc: - raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, str(exc)) from exc + raise HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, str(exc)) from exc return ParentalLeaveFetchResponse.from_entity(fetch) @@ -170,7 +170,7 @@ async def start_fetch( children = await child_repo.list_by_workspace(workspace_id) if not children: raise HTTPException( - status.HTTP_422_UNPROCESSABLE_ENTITY, + status.HTTP_422_UNPROCESSABLE_CONTENT, "No child in workspace — add one before fetching.", ) child_id = children[0].id diff --git a/backend/app/routers/leave_wishes.py b/backend/app/routers/leave_wishes.py index 1179722..81654ef 100644 --- a/backend/app/routers/leave_wishes.py +++ b/backend/app/routers/leave_wishes.py @@ -64,7 +64,7 @@ async def create_leave_wish( wants_dubbeldag=payload.wants_dubbeldag, ) except ValidationError as exc: - raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, str(exc)) from exc + raise HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, str(exc)) from exc return LeaveWishResponse.from_entity(entity) @@ -125,7 +125,7 @@ async def update_leave_wish( _clear_target_days="target_days" in fields_set and payload.target_days is None, ) except ValidationError as exc: - raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, str(exc)) from exc + raise HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, str(exc)) from exc except NotFoundError as exc: raise HTTPException(status.HTTP_404_NOT_FOUND, str(exc)) from exc return LeaveWishResponse.from_entity(entity) diff --git a/backend/app/routers/plan.py b/backend/app/routers/plan.py index 7172788..945c0f2 100644 --- a/backend/app/routers/plan.py +++ b/backend/app/routers/plan.py @@ -34,7 +34,7 @@ async def propose_plan( except NotFoundError as exc: raise HTTPException(status.HTTP_404_NOT_FOUND, str(exc)) from exc except ValidationError as exc: - raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, str(exc)) from exc + raise HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, str(exc)) from exc return PlanProposalResponse.from_domain(proposal) @@ -101,5 +101,5 @@ async def sync_plan( except NotFoundError as exc: raise HTTPException(status.HTTP_404_NOT_FOUND, str(exc)) from exc except ValidationError as exc: - raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, str(exc)) from exc + raise HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, str(exc)) from exc return PlanSyncResponse.from_domain(result) diff --git a/backend/app/routers/planned_day_exclusions.py b/backend/app/routers/planned_day_exclusions.py index 67b0e7c..d7d8189 100644 --- a/backend/app/routers/planned_day_exclusions.py +++ b/backend/app/routers/planned_day_exclusions.py @@ -39,7 +39,7 @@ async def create_planned_day_exclusion( day=payload.date, ) except ValidationError as exc: - raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, str(exc)) from exc + raise HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, str(exc)) from exc return PlannedDayExclusionResponse.from_entity(entity) diff --git a/backend/app/routers/planned_days.py b/backend/app/routers/planned_days.py index 8a8502a..55ff1b7 100644 --- a/backend/app/routers/planned_days.py +++ b/backend/app/routers/planned_days.py @@ -30,10 +30,10 @@ def _to_http_error(exc: ValidationError) -> HTTPException: """ if exc.message_key: return HTTPException( - status.HTTP_422_UNPROCESSABLE_ENTITY, + status.HTTP_422_UNPROCESSABLE_CONTENT, detail={"message_key": exc.message_key, "data": exc.data}, ) - return HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, detail=str(exc)) + return HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, detail=str(exc)) @router.post("", response_model=PlannedLeaveDayResponse, status_code=status.HTTP_201_CREATED) diff --git a/backend/app/routers/preschool_planning_days.py b/backend/app/routers/preschool_planning_days.py index 7bbd3f3..7810c5c 100644 --- a/backend/app/routers/preschool_planning_days.py +++ b/backend/app/routers/preschool_planning_days.py @@ -32,7 +32,7 @@ async def upsert_planned_days( try: entity = await service.upsert_planned(child, year, payload.planned_days) except ValidationError as exc: - raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, str(exc)) from exc + raise HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, str(exc)) from exc return PreschoolPlanningDaysResponse.from_entity(entity) @@ -48,7 +48,7 @@ async def record_taken_days( try: entity = await service.record_taken(child, year, payload.taken_days) except ValidationError as exc: - raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, str(exc)) from exc + raise HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, str(exc)) from exc return PreschoolPlanningDaysResponse.from_entity(entity) diff --git a/backend/app/routers/settings.py b/backend/app/routers/settings.py index db26be7..530e4ae 100644 --- a/backend/app/routers/settings.py +++ b/backend/app/routers/settings.py @@ -83,7 +83,7 @@ async def create_child( ) return _child_to_response(child) except ValidationError as exc: - raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, str(exc)) from exc + raise HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, str(exc)) from exc @child_router.get("/{child_id}", response_model=ChildResponse) @@ -130,7 +130,7 @@ async def update_child( ) return _child_to_response(child) except ValidationError as exc: - raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, str(exc)) from exc + raise HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, str(exc)) from exc except NotFoundError as exc: raise HTTPException(status.HTTP_404_NOT_FOUND, str(exc)) from exc @@ -164,6 +164,6 @@ async def update_parent_settings( ) return PersonalDataResponse.from_entity(updated) except ValidationError as exc: - raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, str(exc)) from exc + raise HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, str(exc)) from exc except NotFoundError as exc: raise HTTPException(status.HTTP_404_NOT_FOUND, str(exc)) from exc diff --git a/backend/app/routers/vacation_days.py b/backend/app/routers/vacation_days.py index b03abe3..8133fba 100644 --- a/backend/app/routers/vacation_days.py +++ b/backend/app/routers/vacation_days.py @@ -30,7 +30,7 @@ async def upsert_vacation_days( saved_days_in=payload.saved_days_in, ) except ValidationError as exc: - raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, str(exc)) from exc + raise HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, str(exc)) from exc return VacationDaysResponse.from_entity(entity) diff --git a/backend/app/routers/workspace.py b/backend/app/routers/workspace.py index c09823d..1b2a499 100644 --- a/backend/app/routers/workspace.py +++ b/backend/app/routers/workspace.py @@ -48,7 +48,7 @@ def _to_http_error(exc: NotFoundError | ValidationError) -> HTTPException: code = ( status.HTTP_404_NOT_FOUND if isinstance(exc, NotFoundError) - else status.HTTP_422_UNPROCESSABLE_ENTITY + else status.HTTP_422_UNPROCESSABLE_CONTENT ) if exc.message_key: return HTTPException(code, detail={"message_key": exc.message_key, "data": exc.data}) @@ -91,7 +91,7 @@ async def update_workspace( code = ( status.HTTP_404_NOT_FOUND if isinstance(exc, NotFoundError) - else status.HTTP_422_UNPROCESSABLE_ENTITY + else status.HTTP_422_UNPROCESSABLE_CONTENT ) raise HTTPException(code, str(exc)) from exc return WorkspaceResponse.from_entity(ws) @@ -220,6 +220,6 @@ async def revoke_invitation( code = ( status.HTTP_404_NOT_FOUND if isinstance(exc, NotFoundError) - else status.HTTP_422_UNPROCESSABLE_ENTITY + else status.HTTP_422_UNPROCESSABLE_CONTENT ) raise HTTPException(code, str(exc)) from exc