diff --git a/api/database.py b/api/database.py index 1cc8ce7..adebd83 100644 --- a/api/database.py +++ b/api/database.py @@ -168,7 +168,7 @@ def to_dict(self): async def get_table( conn, table_id: int, - geometry_type: Literal["polygons", "points", "linestrings"] + geometry_type: Literal["polygons", "points", "lines"] ) -> Table: metadata = MetaData(schema="sources") table_slug = await source_id_to_slug(engine, table_id) @@ -182,7 +182,7 @@ async def get_table( async def get_sources_sub_table_count( engine: AsyncEngine, table_id: int, - geometry_type: Literal["polygons", "points", "linestrings"], + geometry_type: Literal["polygons", "points", "lines"], query_params: list = None ) -> int: async with engine.begin() as conn: @@ -221,7 +221,7 @@ async def get_sources_sub_table_count( async def select_sources_sub_table( engine: AsyncEngine, table_id: int, - geometry_type: Literal["polygons", "points", "linestrings"], + geometry_type: Literal["polygons", "points", "lines"], page: int = 0, page_size: int = 100, query_params: list = None, @@ -268,7 +268,7 @@ async def select_sources_sub_table( async def patch_sources_sub_table( engine: AsyncEngine, table_id: int, - geometry_type: Literal["polygons", "points", "linestrings"], + geometry_type: Literal["polygons", "points", "lines"], update_values: dict, query_params: list = None ) -> CursorResult: diff --git a/api/routes/sources.py b/api/routes/sources.py index 9f7f719..1534fac 100644 --- a/api/routes/sources.py +++ b/api/routes/sources.py @@ -137,7 +137,7 @@ async def get_sub_sources_geometries( engine = get_engine() async with engine.begin() as conn: - for geometry in ["polygons", "linestrings", "points"]: + for geometry in ["polygons", "lines", "points"]: try: table = await get_table(conn, table_id, geometry) @@ -153,7 +153,7 @@ async def get_sub_sources_helper( response: Response, request: starlette.requests.Request, table_id: int, - geometry_type: Literal["polygons", "linestrings", "points"], + geometry_type: Literal["polygons", "lines", "points"], page: int = 0, page_size: int = 100 ) -> List[Union[PolygonResponseModel, LineStringModel, PointModel]]: @@ -210,7 +210,7 @@ async def get_sub_sources( return await get_sub_sources_helper(response, request, table_id, "points", page, page_size) -@router.get("/{table_id}/linestrings", response_model=List[LineStringModel]) +@router.get("/{table_id}/lines", response_model=List[LineStringModel]) async def get_sub_sources( response: Response, request: starlette.requests.Request, @@ -218,14 +218,14 @@ async def get_sub_sources( page: int = 0, page_size: int = 100 ): - return await get_sub_sources_helper(response, request, table_id, "linestrings", page, page_size) + return await get_sub_sources_helper(response, request, table_id, "lines", page, page_size) @router.patch("/{table_id}/{geometry_type}") async def patch_sub_sources( request: starlette.requests.Request, table_id: int, - geometry_type: Literal["polygons", "linestrings", "points"], + geometry_type: Literal["polygons", "lines", "points"], updates: Union[PolygonRequestModel, LineStringModel, PointModel], user_has_access: bool = Depends(has_access) ) -> List[Union[PolygonResponseModel, LineStringModel, PointModel]]: @@ -259,7 +259,7 @@ async def patch_sub_sources( request: starlette.requests.Request, target_column: str, table_id: int, - geometry_type: Literal["polygons", "linestrings", "points"], + geometry_type: Literal["polygons", "lines", "points"], copy_column: CopyColumnRequest, user_has_access: bool = Depends(has_access), ): diff --git a/api/tests/sources.py b/api/tests/sources.py index 55ef149..87b02e4 100644 --- a/api/tests/sources.py +++ b/api/tests/sources.py @@ -81,8 +81,8 @@ def test_get_sources_points_table(self, api_client: TestClient): assert len(response_json) > 0 - def test_get_source_linestrings_table(self, api_client: TestClient): - response = api_client.get(f"/sources/{TEST_SOURCE_TABLE.source_id}/linestrings") + def test_get_source_lines_table(self, api_client: TestClient): + response = api_client.get(f"/sources/{TEST_SOURCE_TABLE.source_id}/lines") assert response.status_code == 200 response_json = response.json()