From d36c66f18b21c8ba47c579c7c6e333e9ceb4250f Mon Sep 17 00:00:00 2001 From: Nathan Zimmerman Date: Mon, 22 Jan 2024 13:56:39 -0600 Subject: [PATCH 1/2] Enable transactions extension for demo --- stac_api/runtime/src/config.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/stac_api/runtime/src/config.py b/stac_api/runtime/src/config.py index a8149950..df84a20f 100644 --- a/stac_api/runtime/src/config.py +++ b/stac_api/runtime/src/config.py @@ -8,9 +8,8 @@ import boto3 import pydantic +from fastapi.responses import ORJSONResponse from stac_fastapi.api.models import create_get_request_model, create_post_request_model - -# from stac_fastapi.pgstac.extensions import QueryExtension from stac_fastapi.extensions.core import ( ContextExtension, FieldsExtension, @@ -18,8 +17,10 @@ QueryExtension, SortExtension, TokenPaginationExtension, + TransactionExtension, ) from stac_fastapi.pgstac.config import Settings +from stac_fastapi.pgstac.transactions import TransactionsClient from stac_fastapi.pgstac.types.search import PgstacSearch @@ -126,6 +127,11 @@ def TilesApiSettings() -> _TilesApiSettings: FieldsExtension(), TokenPaginationExtension(), ContextExtension(), + TransactionExtension( + client=TransactionsClient(), + settings=ApiSettings().load_postgres_settings(), + response_class=ORJSONResponse, + ), ] post_request_model = create_post_request_model(extensions, base_model=PgstacSearch) get_request_model = create_get_request_model(extensions) From 3b34fbd93e534161ad1e072c48f39b3b911bb9db Mon Sep 17 00:00:00 2001 From: Nathan Zimmerman Date: Mon, 22 Jan 2024 14:47:14 -0600 Subject: [PATCH 2/2] Add support for PUTs --- stac_api/runtime/src/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stac_api/runtime/src/app.py b/stac_api/runtime/src/app.py index 9d1249b0..91a3e50d 100644 --- a/stac_api/runtime/src/app.py +++ b/stac_api/runtime/src/app.py @@ -61,7 +61,7 @@ CORSMiddleware, allow_origins=api_settings.cors_origins, allow_credentials=True, - allow_methods=["GET", "POST", "OPTIONS"], + allow_methods=["GET", "POST", "PUT", "OPTIONS"], allow_headers=["*"], )