Remove unused db functions

This commit is contained in:
Daniel Roth 2026-02-19 12:22:19 +00:00
parent dae74d2f8b
commit 9d12eef0e5

View file

@ -625,13 +625,6 @@ def get_plans_by_portfolio_id(portfolio_id: int) -> List[PlanModel]:
return session_any.exec(stmt).scalars().all()
def get_plans_by_ids(ids: List[int]) -> List[PlanModel]:
stmt = select(PlanModel).where(PlanModel.id.in_(ids))
with db_read_session() as session:
session_any: Any = session # Typehint as Any to satisfy Pylance...
return session_any.exec(stmt).scalars().all()
def get_plans_by_scenario_ids(ids: List[int]) -> List[PlanModel]:
stmt = select(PlanModel).where(PlanModel.scenario_id.in_(ids))
with db_read_session() as session:
@ -653,24 +646,6 @@ def get_scenarios_by_portfolio_id(portfolio_id: int) -> List[ScenarioModel]:
return session_any.exec(stmt).scalars().all()
def get_scenario(scenario_id: int) -> Optional[ScenarioModel]:
stmt = select(ScenarioModel).where(ScenarioModel.id == scenario_id)
with db_read_session() as session:
session_any: Any = session # Typehint as Any to satisfy Pylance...
return session_any.exec(stmt).scalar_one_or_none()
def get_default_plan_ids_for_property(property_id: int) -> List[int]:
# This should in reality always return exactly 1 ID, but there's currently
# no database constraint to enforce that, so account for 0 or >1
stmt = select(PlanModel.id).where(
(PlanModel.property_id == property_id) & (PlanModel.is_default == True)
)
with db_read_session() as session:
session_any: Any = session # Typehint as Any to satisfy Pylance...
return session_any.exec(stmt).scalars().all()
def get_default_scenario_ids_for_portfolio(portfolio_id: int) -> List[int]:
# This should in reality always return exactly 1 ID, but there's currently
# no database constraint to enforce that, so account for 0 or >1