-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
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.
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.
Looking good, just some minor comments. Maybe it would make sense to also have a e2e test or two
app/stac_api/models.py
Outdated
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 |
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.
Only one colleciton asset upload in progress
app/stac_api/models.py
Outdated
is set to its asset parent. | ||
''' | ||
logger.debug( | ||
'Updating asset %s file:checksum from %s to %s and update_interval from %d to %d ' |
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.
Maybe here also state that it's a collection asset upload
app/stac_api/s3_multipart_upload.py
Outdated
@@ -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): |
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.
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.', |
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.
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.
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. |
Move asset views to item file, move collection asset views to collection file.
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.
Very nice! 👌
Files should not have the same name as their folder.
File names should not be the same as their folder
Refactor views and serializers
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?