-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enclosure addition in feature collection links #230
base: main
Are you sure you want to change the base?
Conversation
retest this please |
if (success.isEmpty()) { | ||
LOGGER.error("Collections table is empty!"); | ||
result.fail( | ||
new OgcException(404, "Not found", "Collection table is Empty!")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot throw a 404
exception here because /collections
is a valid path. If the table is empty just return an empty response or a JsonObject for collections
object.
if (successItem | ||
.getString("id") | ||
.equals(enclosure.getString("collections_id"))) { | ||
if (successItem.containsKey("enclosure")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is the successItem
having the enclosure
key beforehand?
LOGGER.warn("Assets table is empty!"); | ||
result.complete(success); | ||
} else { | ||
for (JsonObject enclosure : enclosureResult) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of running a double for loop, what you can try and verify is to change the query itself to join the table collections_enclosure
and use json_agg()
, refer-
", jsonb_agg((row_to_json(stac_items_assets.*)::jsonb - 'item_id')) as assetobjects" + |
|
||
INSERT INTO collections_enclosure (id, collections_id, title, href, type, size) | ||
SELECT id, stac_collections_id, title, href, type, size | ||
FROM stac_collections_assets; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add a truncate
statement to the stac_collections_assets
table since all the data will now be moved to a new table and all existing rows won't have any relation with the new data that will added in the future.
"SELECT collections_details.id, title, " | ||
+ "description, bbox, temporal, license FROM collections_details " | ||
+ "JOIN collection_type ON collections_details.id = collection_type.collection_id " | ||
+ "WHERE collection_type.type = 'STAC' AND collections_details.id = $1::uuid GROUP " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you require a GROUP BY
clause?
/api
which are not of type STAC and in/stac/api
to include collection of type STAC