Merge branch 'worktree-fix-deprecations-backend-plan'
Rename Starlette HTTP_422_UNPROCESSABLE_ENTITY to HTTP_422_UNPROCESSABLE_CONTENT across routers and switch alembic.ini to path_separator. Conflicts: main had already deleted planned_day_exclusions.py and the write endpoints in planned_days.py, so main's side was kept there. The rename was also applied to day_assertion.py and the newer plan.py handler that main added after the branch point. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T4wjgbVL4HAC5Rdaw75VbV
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
[alembic]
|
[alembic]
|
||||||
script_location = migrations
|
script_location = migrations
|
||||||
prepend_sys_path = .
|
prepend_sys_path = .
|
||||||
version_path_separator = os
|
path_separator = os
|
||||||
# Last-resort fallback only. migrations/env.py's _resolve_url() overrides this
|
# 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=...`
|
# 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.
|
# argument) whenever either is available — this value is used only if neither is.
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ async def get_context(
|
|||||||
"""Return workspace + children for the current user. Used by the dev harness."""
|
"""Return workspace + children for the current user. Used by the dev harness."""
|
||||||
pd = await pd_repo.get_by_id(current_user.personal_data_uuid)
|
pd = await pd_repo.get_by_id(current_user.personal_data_uuid)
|
||||||
if pd is None:
|
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)
|
children = await child_repo.list_by_workspace(pd.workspace_id)
|
||||||
return _UserContext(
|
return _UserContext(
|
||||||
personal_data_uuid=str(pd.uuid),
|
personal_data_uuid=str(pd.uuid),
|
||||||
|
|||||||
@@ -31,5 +31,5 @@ async def get_calendar_days(
|
|||||||
workspace_id=workspace_id, start_year=start_year, years=years
|
workspace_id=workspace_id, start_year=start_year, years=years
|
||||||
)
|
)
|
||||||
except ValidationError as 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 CalendarDaysResponse.from_domain(window)
|
return CalendarDaysResponse.from_domain(window)
|
||||||
|
|||||||
@@ -45,10 +45,10 @@ async def assert_day(
|
|||||||
except ValidationError as exc:
|
except ValidationError as exc:
|
||||||
if exc.message_key:
|
if exc.message_key:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status.HTTP_422_UNPROCESSABLE_ENTITY,
|
status.HTTP_422_UNPROCESSABLE_CONTENT,
|
||||||
detail={"message_key": exc.message_key, "data": exc.data},
|
detail={"message_key": exc.message_key, "data": exc.data},
|
||||||
) from exc
|
) from exc
|
||||||
raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY, str(exc)) from exc
|
raise HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, str(exc)) from exc
|
||||||
return DayAssertionResponse.from_entity(entity)
|
return DayAssertionResponse.from_entity(entity)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ async def upsert_day_override(
|
|||||||
note=payload.note,
|
note=payload.note,
|
||||||
)
|
)
|
||||||
except ValidationError as 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 DayOverrideResponse.from_entity(entity)
|
return DayOverrideResponse.from_entity(entity)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ async def save_manual_entry(
|
|||||||
source=payload.source,
|
source=payload.source,
|
||||||
)
|
)
|
||||||
except ValidationError as 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 ParentalLeaveFetchResponse.from_entity(fetch)
|
return ParentalLeaveFetchResponse.from_entity(fetch)
|
||||||
|
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ async def start_fetch(
|
|||||||
children = await child_repo.list_by_workspace(workspace_id)
|
children = await child_repo.list_by_workspace(workspace_id)
|
||||||
if not children:
|
if not children:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status.HTTP_422_UNPROCESSABLE_ENTITY,
|
status.HTTP_422_UNPROCESSABLE_CONTENT,
|
||||||
"No child in workspace — add one before fetching.",
|
"No child in workspace — add one before fetching.",
|
||||||
)
|
)
|
||||||
child_id = children[0].id
|
child_id = children[0].id
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ async def create_leave_wish(
|
|||||||
wants_dubbeldag=payload.wants_dubbeldag,
|
wants_dubbeldag=payload.wants_dubbeldag,
|
||||||
)
|
)
|
||||||
except ValidationError as 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 LeaveWishResponse.from_entity(entity)
|
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,
|
_clear_target_days="target_days" in fields_set and payload.target_days is None,
|
||||||
)
|
)
|
||||||
except ValidationError as 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
|
||||||
except NotFoundError as exc:
|
except NotFoundError as exc:
|
||||||
raise HTTPException(status.HTTP_404_NOT_FOUND, str(exc)) from exc
|
raise HTTPException(status.HTTP_404_NOT_FOUND, str(exc)) from exc
|
||||||
return LeaveWishResponse.from_entity(entity)
|
return LeaveWishResponse.from_entity(entity)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ async def propose_plan(
|
|||||||
except NotFoundError as exc:
|
except NotFoundError as exc:
|
||||||
raise HTTPException(status.HTTP_404_NOT_FOUND, str(exc)) from exc
|
raise HTTPException(status.HTTP_404_NOT_FOUND, str(exc)) from exc
|
||||||
except ValidationError as 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)
|
return PlanProposalResponse.from_domain(proposal)
|
||||||
|
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ async def sync_plan(
|
|||||||
except NotFoundError as exc:
|
except NotFoundError as exc:
|
||||||
raise HTTPException(status.HTTP_404_NOT_FOUND, str(exc)) from exc
|
raise HTTPException(status.HTTP_404_NOT_FOUND, str(exc)) from exc
|
||||||
except ValidationError as 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)
|
return PlanSyncResponse.from_domain(result)
|
||||||
|
|
||||||
|
|
||||||
@@ -147,5 +147,5 @@ async def sync_plan_with_wish(
|
|||||||
except NotFoundError as exc:
|
except NotFoundError as exc:
|
||||||
raise HTTPException(status.HTTP_404_NOT_FOUND, str(exc)) from exc
|
raise HTTPException(status.HTTP_404_NOT_FOUND, str(exc)) from exc
|
||||||
except ValidationError as 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 PlanSyncWithWishResponse.from_domain(result)
|
return PlanSyncWithWishResponse.from_domain(result)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ async def upsert_planned_days(
|
|||||||
try:
|
try:
|
||||||
entity = await service.upsert_planned(child, year, payload.planned_days)
|
entity = await service.upsert_planned(child, year, payload.planned_days)
|
||||||
except ValidationError as 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 PreschoolPlanningDaysResponse.from_entity(entity)
|
return PreschoolPlanningDaysResponse.from_entity(entity)
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ async def record_taken_days(
|
|||||||
try:
|
try:
|
||||||
entity = await service.record_taken(child, year, payload.taken_days)
|
entity = await service.record_taken(child, year, payload.taken_days)
|
||||||
except ValidationError as 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 PreschoolPlanningDaysResponse.from_entity(entity)
|
return PreschoolPlanningDaysResponse.from_entity(entity)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ async def create_child(
|
|||||||
)
|
)
|
||||||
return _child_to_response(child)
|
return _child_to_response(child)
|
||||||
except ValidationError as 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
|
||||||
|
|
||||||
|
|
||||||
@child_router.get("/{child_id}", response_model=ChildResponse)
|
@child_router.get("/{child_id}", response_model=ChildResponse)
|
||||||
@@ -130,7 +130,7 @@ async def update_child(
|
|||||||
)
|
)
|
||||||
return _child_to_response(child)
|
return _child_to_response(child)
|
||||||
except ValidationError as 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
|
||||||
except NotFoundError as exc:
|
except NotFoundError as exc:
|
||||||
raise HTTPException(status.HTTP_404_NOT_FOUND, str(exc)) from 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)
|
return PersonalDataResponse.from_entity(updated)
|
||||||
except ValidationError as 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
|
||||||
except NotFoundError as exc:
|
except NotFoundError as exc:
|
||||||
raise HTTPException(status.HTTP_404_NOT_FOUND, str(exc)) from exc
|
raise HTTPException(status.HTTP_404_NOT_FOUND, str(exc)) from exc
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ async def upsert_vacation_days(
|
|||||||
saved_days_in=payload.saved_days_in,
|
saved_days_in=payload.saved_days_in,
|
||||||
)
|
)
|
||||||
except ValidationError as 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 VacationDaysResponse.from_entity(entity)
|
return VacationDaysResponse.from_entity(entity)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ def _to_http_error(exc: NotFoundError | ValidationError) -> HTTPException:
|
|||||||
code = (
|
code = (
|
||||||
status.HTTP_404_NOT_FOUND
|
status.HTTP_404_NOT_FOUND
|
||||||
if isinstance(exc, NotFoundError)
|
if isinstance(exc, NotFoundError)
|
||||||
else status.HTTP_422_UNPROCESSABLE_ENTITY
|
else status.HTTP_422_UNPROCESSABLE_CONTENT
|
||||||
)
|
)
|
||||||
if exc.message_key:
|
if exc.message_key:
|
||||||
return HTTPException(code, detail={"message_key": exc.message_key, "data": exc.data})
|
return HTTPException(code, detail={"message_key": exc.message_key, "data": exc.data})
|
||||||
@@ -91,7 +91,7 @@ async def update_workspace(
|
|||||||
code = (
|
code = (
|
||||||
status.HTTP_404_NOT_FOUND
|
status.HTTP_404_NOT_FOUND
|
||||||
if isinstance(exc, NotFoundError)
|
if isinstance(exc, NotFoundError)
|
||||||
else status.HTTP_422_UNPROCESSABLE_ENTITY
|
else status.HTTP_422_UNPROCESSABLE_CONTENT
|
||||||
)
|
)
|
||||||
raise HTTPException(code, str(exc)) from exc
|
raise HTTPException(code, str(exc)) from exc
|
||||||
return WorkspaceResponse.from_entity(ws)
|
return WorkspaceResponse.from_entity(ws)
|
||||||
@@ -220,6 +220,6 @@ async def revoke_invitation(
|
|||||||
code = (
|
code = (
|
||||||
status.HTTP_404_NOT_FOUND
|
status.HTTP_404_NOT_FOUND
|
||||||
if isinstance(exc, NotFoundError)
|
if isinstance(exc, NotFoundError)
|
||||||
else status.HTTP_422_UNPROCESSABLE_ENTITY
|
else status.HTTP_422_UNPROCESSABLE_CONTENT
|
||||||
)
|
)
|
||||||
raise HTTPException(code, str(exc)) from exc
|
raise HTTPException(code, str(exc)) from exc
|
||||||
|
|||||||
Reference in New Issue
Block a user