refactor(backend)!: separate algorithm and data layers
Reorganize algorithm packages by business responsibility, move orchestration into services, and keep database access behind pooled repositories. Harden analysis API validation, remove unsafe legacy simulation endpoints, and add regression and architecture boundary coverage. BREAKING CHANGE: legacy algorithm module paths and obsolete simulation endpoints are removed.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
"""Read repositories for project network assets."""
|
||||
|
||||
from typing import Any
|
||||
|
||||
from psycopg import AsyncConnection
|
||||
|
||||
|
||||
class NetworkAssetRepository:
|
||||
@staticmethod
|
||||
async def get_pipes_by_ids(
|
||||
conn: AsyncConnection,
|
||||
pipe_ids: list[str],
|
||||
) -> list[dict[str, Any]]:
|
||||
if not pipe_ids:
|
||||
return []
|
||||
async with conn.cursor() as cur:
|
||||
await cur.execute(
|
||||
"""
|
||||
SELECT id, diameter, start_node_id AS node1,
|
||||
end_node_id AS node2
|
||||
FROM gis.pipes
|
||||
WHERE id = ANY(%s)
|
||||
ORDER BY id
|
||||
""",
|
||||
(pipe_ids,),
|
||||
)
|
||||
return await cur.fetchall()
|
||||
Reference in New Issue
Block a user