Skip to content
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

PB-756: CRUD API for collection assets #456

Merged
merged 16 commits into from
Sep 12, 2024
Merged

Conversation

benschs
Copy link
Contributor

@benschs benschs commented Sep 9, 2024

Add collection asset endpoints for stac v1. Endpoint to get list, get single, create, update and delete assets.

Basically duplicated the Asset Views and Serializers for Collection Assets and adapted. The main difference is that there is obviously no item for collection assets, as well as no external url allowed. They also do not have the fields eo_gsd, geoadmin_lang, geoadmin_variant.

The files for views and serializers are now each over 1000 lines of code. Is there a guideline how we might split this into smaller files?

Add collection asset endpoints for stac v1. Duplicate asset views and
serializers for collection assets.
Add upload endpoints for collection assets. Mostly a duplication of the already
existing multipart upload endpoints.
Use shared base class for asset upload and collection asset upload.
Copy link
Contributor

@schtibe schtibe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, just some minor comments. Maybe it would make sense to also have a e2e test or two

fields=['asset', 'upload_id'],
name='unique_asset_upload_collection_asset_upload_id'
),
# Make sure that there is only one asset upload in progress per asset
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one colleciton asset upload in progress

is set to its asset parent.
'''
logger.debug(
'Updating asset %s file:checksum from %s to %s and update_interval from %d to %d '
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe here also state that it's a collection asset upload

@@ -65,6 +65,24 @@ def list_multipart_uploads(self, key=None, limit=100, start=None):
response.get('NextUploadIdMarker', None),
)

def log_extra(self, asset, upload_id=None, parts=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just wondering what happens if you would start to use type hints here with typing asset to AssetBase 😊

models.IntegerField(
default=-1,
help_text=
'Interval in seconds in which the asset data is updated.-1 means that the data is not on a regular basis updated.This field can only be set via the API.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. The spaces after the dots the spaces are missing. I see you have this multi split string in models.py, and apparently they're concated directly without anything between.

Add type hint for new function log_extra.
@schtibe
Copy link
Contributor

schtibe commented Sep 10, 2024

The files for views and serializers are now each over 1000 lines of code. Is there a guideline how we might split this into smaller files?

In django it would be possible to split those into multiple apps. But I'm not sure if or how this makes sense in this case here. From a URL perspective, everything kinda belongs together.
Otherwise it could maybe make sense to split away the upload part of the API. But also not sure if that's really helpful in terms of file sizes?

Copy link
Contributor

@boecklic boecklic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! 👌

benschs and others added 5 commits September 11, 2024 13:41
Files should not have the same name as their folder.
File names should not be the same as their folder
@benschs benschs merged commit a6bdf49 into develop Sep 12, 2024
3 checks passed
@benschs benschs deleted the feat-PB-756-api-col-assets branch September 12, 2024 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants