diff --git a/setup.py b/setup.py index 0f92d5b7..f15eb7fc 100644 --- a/setup.py +++ b/setup.py @@ -9,9 +9,9 @@ "attrs", "orjson", "pydantic", - "stac-fastapi.api>=5.2,<6.0", - "stac-fastapi.extensions>=5.2,<6.0", - "stac-fastapi.types>=5.2,<6.0", + "stac-fastapi.api>=6.0,<7.0", + "stac-fastapi.extensions>=6.0,<7.0", + "stac-fastapi.types>=6.0,<7.0", "asyncpg", "buildpg", "brotli_asgi", diff --git a/stac_fastapi/pgstac/transactions.py b/stac_fastapi/pgstac/transactions.py index b4a68c40..27d3ae03 100644 --- a/stac_fastapi/pgstac/transactions.py +++ b/stac_fastapi/pgstac/transactions.py @@ -2,18 +2,23 @@ import logging import re -from typing import Optional, Union +from typing import List, Optional, Union import attr from buildpg import render from fastapi import HTTPException, Request +from stac_fastapi.extensions.core.transaction import AsyncBaseTransactionsClient +from stac_fastapi.extensions.core.transaction.request import ( + PartialCollection, + PartialItem, + PatchOperation, +) from stac_fastapi.extensions.third_party.bulk_transactions import ( AsyncBaseBulkTransactionsClient, BulkTransactionMethod, Items, ) from stac_fastapi.types import stac as stac_types -from stac_fastapi.types.core import AsyncBaseTransactionsClient from stac_pydantic import Collection, Item, ItemCollection from starlette.responses import JSONResponse, Response @@ -203,6 +208,25 @@ async def delete_collection( return JSONResponse({"deleted collection": collection_id}) + async def patch_item( + self, + collection_id: str, + item_id: str, + patch: Union[PartialItem, List[PatchOperation]], + **kwargs, + ) -> Optional[Union[stac_types.Item, Response]]: + """Patch Item.""" + raise NotImplementedError + + async def patch_collection( + self, + collection_id: str, + patch: Union[PartialCollection, List[PatchOperation]], + **kwargs, + ) -> Optional[Union[stac_types.Collection, Response]]: + """Patch Collection.""" + raise NotImplementedError + @attr.s class BulkTransactionsClient(AsyncBaseBulkTransactionsClient, ClientValidateMixIn): diff --git a/stac_fastapi/pgstac/types/search.py b/stac_fastapi/pgstac/types/search.py index 2ccc5c14..90c200ce 100644 --- a/stac_fastapi/pgstac/types/search.py +++ b/stac_fastapi/pgstac/types/search.py @@ -18,7 +18,7 @@ class PgstacSearch(BaseSearchPostRequest): @classmethod def validate_query_uses_cql(cls, v: str, info: ValidationInfo): """Use of Query Extension is not allowed with cql2.""" - if info.data.get("query", None) is not None and v != "cql-json": + if info.data.get("query", None) is not None: raise ValueError( "Query extension is not available when using pgstac with cql2" ) diff --git a/tests/resources/test_item.py b/tests/resources/test_item.py index ae9eb450..a97077fb 100644 --- a/tests/resources/test_item.py +++ b/tests/resources/test_item.py @@ -1356,52 +1356,6 @@ async def test_preserves_extra_link( assert extra_link[0]["href"] == expected_href -async def test_item_search_post_filter_extension_cql_explicitlang( - app_client, load_test_data, load_test_collection -): - """Test POST search with JSONB query (cql json filter extension)""" - test_item = load_test_data("test_item.json") - resp = await app_client.post( - f"/collections/{test_item['collection']}/items", json=test_item - ) - assert resp.status_code == 201 - - # EPSG is a JSONB key - params = { - "collections": [test_item["collection"]], - "filter-lang": "cql-json", - "filter": { - "gt": [ - {"property": "proj:epsg"}, - test_item["properties"]["proj:epsg"] + 1, - ] - }, - } - resp = await app_client.post("/search", json=params) - resp_json = resp.json() - - assert resp.status_code == 200 - assert len(resp_json.get("features")) == 0 - - params = { - "collections": [test_item["collection"]], - "filter-lang": "cql-json", - "filter": { - "eq": [ - {"property": "proj:epsg"}, - test_item["properties"]["proj:epsg"], - ] - }, - } - resp = await app_client.post("/search", json=params) - resp_json = resp.json() - assert len(resp.json()["features"]) == 1 - assert ( - resp_json["features"][0]["properties"]["proj:epsg"] - == test_item["properties"]["proj:epsg"] - ) - - async def test_item_search_post_filter_extension_cql2_2( app_client, load_test_data, load_test_collection ): @@ -1622,26 +1576,6 @@ async def test_get_filter_extension(app_client, load_test_data, load_test_collec assert len(fc["features"]) == 1 assert fc["features"][0]["id"] == search_id - # CQL-JSON - resp = await app_client.get( - "/search", - params={ - "filter-lang": "cql-json", - "filter": json.dumps( - { - "eq": [ - {"property": "id"}, - search_id, - ], - }, - ), - }, - ) - assert resp.status_code == 200 - fc = resp.json() - assert len(fc["features"]) == 1 - assert fc["features"][0]["id"] == search_id - # CQL2-TEXT resp = await app_client.get( "/search", @@ -1669,26 +1603,6 @@ async def test_get_filter_extension(app_client, load_test_data, load_test_collec assert len(fc["features"]) == 1 assert fc["features"][0]["id"] == search_id - # CQL-JSON - resp = await app_client.get( - f"/collections/{collection_id}/items", - params={ - "filter-lang": "cql-json", - "filter": json.dumps( - { - "eq": [ - {"property": "id"}, - search_id, - ], - }, - ), - }, - ) - assert resp.status_code == 200 - fc = resp.json() - assert len(fc["features"]) == 1 - assert fc["features"][0]["id"] == search_id - # CQL2-TEXT resp = await app_client.get( f"/collections/{collection_id}/items",