Reorganize WNDB by responsibility and remove legacy scheme endpoints.\n\nRoute analysis and time-series access through project pools, preserve transactional realtime replacement, and refresh GIS materialized views after writes.\n\nAdd database architecture documentation, live pooling coverage, API contract updates, and executable container verification.\n\nBREAKING CHANGE: legacy scheme APIs and flat app.native.wndb module imports are removed.
66 lines
2.0 KiB
Python
66 lines
2.0 KiB
Python
"""Convenience entry points for cascade deletes and option synchronization."""
|
|
|
|
from ..core.database import API_DELETE, API_UPDATE, ChangeSet
|
|
from .executor import execute_batch_command
|
|
|
|
|
|
def _execute(
|
|
name: str,
|
|
change_set: ChangeSet,
|
|
*,
|
|
operation: str,
|
|
element_type: str,
|
|
) -> ChangeSet:
|
|
change_set.operations[0].update(
|
|
{"operation": operation, "type": element_type}
|
|
)
|
|
return execute_batch_command(name, change_set)
|
|
|
|
|
|
def delete_junction_cascade(name: str, change_set: ChangeSet) -> ChangeSet:
|
|
return _execute(
|
|
name, change_set, operation=API_DELETE, element_type="junction"
|
|
)
|
|
|
|
|
|
def delete_reservoir_cascade(name: str, change_set: ChangeSet) -> ChangeSet:
|
|
return _execute(
|
|
name, change_set, operation=API_DELETE, element_type="reservoir"
|
|
)
|
|
|
|
|
|
def delete_tank_cascade(name: str, change_set: ChangeSet) -> ChangeSet:
|
|
return _execute(name, change_set, operation=API_DELETE, element_type="tank")
|
|
|
|
|
|
def delete_pipe_cascade(name: str, change_set: ChangeSet) -> ChangeSet:
|
|
return _execute(name, change_set, operation=API_DELETE, element_type="pipe")
|
|
|
|
|
|
def delete_pump_cascade(name: str, change_set: ChangeSet) -> ChangeSet:
|
|
return _execute(name, change_set, operation=API_DELETE, element_type="pump")
|
|
|
|
|
|
def delete_valve_cascade(name: str, change_set: ChangeSet) -> ChangeSet:
|
|
return _execute(name, change_set, operation=API_DELETE, element_type="valve")
|
|
|
|
|
|
def delete_pattern_cascade(name: str, change_set: ChangeSet) -> ChangeSet:
|
|
return _execute(
|
|
name, change_set, operation=API_DELETE, element_type="pattern"
|
|
)
|
|
|
|
|
|
def delete_curve_cascade(name: str, change_set: ChangeSet) -> ChangeSet:
|
|
return _execute(name, change_set, operation=API_DELETE, element_type="curve")
|
|
|
|
|
|
def set_option_ex(name: str, change_set: ChangeSet) -> ChangeSet:
|
|
return _execute(name, change_set, operation=API_UPDATE, element_type="option")
|
|
|
|
|
|
def set_option_v3_ex(name: str, change_set: ChangeSet) -> ChangeSet:
|
|
return _execute(
|
|
name, change_set, operation=API_UPDATE, element_type="option_v3"
|
|
)
|