feat: retrieve tenant from collection for items and ingest endpoints#573
feat: retrieve tenant from collection for items and ingest endpoints#573
Conversation
…a-backend into mt-uma/pep-items
…te lookup method, add to config
| ) | ||
| creds = get_db_credentials(os.environ["DB_SECRET_ARN"]) | ||
| try: | ||
| with PgstacDB(dsn=creds.dsn_string, debug=True) as db: |
There was a problem hiding this comment.
I initially tried to use the collection loader / VEDALoader to get information on the collection, but because the tenancy field is non standard, it didn't yield any results compared to directly querying like so (lines 49-50).
| tenant = await _collection_tenant_for_item(request, collection_id) | ||
| if tenant: | ||
| return STAC_COLLECTION_TEMPLATE.format(tenant) | ||
| return _stac_collection_resource_id(request) |
There was a problem hiding this comment.
Can probably remove this? Since without this, it will next land on line 153 which is returning same?
There was a problem hiding this comment.
I think we need it because, otherwise, it wouldn't land on line 153 but it would land on the outermost return which would be None, and we want to make sure it falls back to get the collection resource ID using the request if it doesn't manage to resolve using the resolver (looking up in the DB in the case of DELETEs)
|
|
||
|
|
||
| async def _extract_item_stac_resource_id( | ||
| request: Request, path: str, method: str |
There was a problem hiding this comment.
is method being used?
There was a problem hiding this comment.
😯 good call out! Let me remove it
sandrahoang686
left a comment
There was a problem hiding this comment.
code wise - lgtm!
Issue
#559
And to begin supporting #560
What?
Testing?
https://sit.openveda.cloud/api/ingest/docs
https://sit.openveda.cloud/api/stac/docs