-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #456 from geoadmin/feat-PB-756-api-col-assets
PB-756: CRUD API for collection assets
- Loading branch information
Showing
35 changed files
with
5,095 additions
and
1,880 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
147 changes: 147 additions & 0 deletions
147
app/stac_api/migrations/0050_collectionassetupload_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
# Generated by Django 5.0.8 on 2024-09-10 12:45 | ||
|
||
import pgtrigger.compiler | ||
import pgtrigger.migrations | ||
|
||
import django.core.serializers.json | ||
import django.core.validators | ||
import django.db.models.deletion | ||
from django.db import migrations | ||
from django.db import models | ||
|
||
import stac_api.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('stac_api', '0049_item_properties_expires'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='assetupload', | ||
name='update_interval', | ||
field=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.', | ||
validators=[django.core.validators.MinValueValidator(-1)] | ||
), | ||
), | ||
migrations.CreateModel( | ||
name='CollectionAssetUpload', | ||
fields=[ | ||
('id', models.BigAutoField(primary_key=True, serialize=False)), | ||
('upload_id', models.CharField(max_length=255)), | ||
( | ||
'status', | ||
models.CharField( | ||
choices=[(None, ''), ('in-progress', 'In Progress'), | ||
('completed', 'Completed'), ('aborted', 'Aborted')], | ||
default='in-progress', | ||
max_length=32 | ||
) | ||
), | ||
( | ||
'number_parts', | ||
models.IntegerField( | ||
validators=[ | ||
django.core.validators.MinValueValidator(1), | ||
django.core.validators.MaxValueValidator(100) | ||
] | ||
) | ||
), | ||
( | ||
'md5_parts', | ||
models.JSONField( | ||
editable=False, encoder=django.core.serializers.json.DjangoJSONEncoder | ||
) | ||
), | ||
( | ||
'urls', | ||
models.JSONField( | ||
blank=True, | ||
default=list, | ||
encoder=django.core.serializers.json.DjangoJSONEncoder | ||
) | ||
), | ||
('created', models.DateTimeField(auto_now_add=True)), | ||
('ended', models.DateTimeField(blank=True, default=None, null=True)), | ||
('checksum_multihash', models.CharField(max_length=255)), | ||
('etag', models.CharField(default=stac_api.models.compute_etag, max_length=56)), | ||
( | ||
'update_interval', | ||
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.', | ||
validators=[django.core.validators.MinValueValidator(-1)] | ||
) | ||
), | ||
( | ||
'content_encoding', | ||
models.CharField( | ||
blank=True, | ||
choices=[(None, ''), ('gzip', 'Gzip'), ('br', 'Br')], | ||
default='', | ||
max_length=32 | ||
) | ||
), | ||
( | ||
'asset', | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name='+', | ||
to='stac_api.collectionasset' | ||
) | ||
), | ||
], | ||
), | ||
migrations.AddConstraint( | ||
model_name='collectionassetupload', | ||
constraint=models.UniqueConstraint( | ||
fields=('asset', 'upload_id'), | ||
name='unique_asset_upload_collection_asset_upload_id' | ||
), | ||
), | ||
migrations.AddConstraint( | ||
model_name='collectionassetupload', | ||
constraint=models.UniqueConstraint( | ||
condition=models.Q(('status', 'in-progress')), | ||
fields=('asset', 'status'), | ||
name='unique_asset_upload_in_progress' | ||
), | ||
), | ||
pgtrigger.migrations.AddTrigger( | ||
model_name='collectionassetupload', | ||
trigger=pgtrigger.compiler.Trigger( | ||
name='add_asset_upload_trigger', | ||
sql=pgtrigger.compiler.UpsertTriggerSql( | ||
func= | ||
'\n -- update AssetUpload auto variable\n NEW.etag = public.gen_random_uuid();\n\n RETURN NEW;\n ', | ||
hash='5f51ec3c72c4d9fbe6b81d2fd881dd5228dc80bf', | ||
operation='INSERT', | ||
pgid='pgtrigger_add_asset_upload_trigger_8330c', | ||
table='stac_api_collectionassetupload', | ||
when='BEFORE' | ||
) | ||
), | ||
), | ||
pgtrigger.migrations.AddTrigger( | ||
model_name='collectionassetupload', | ||
trigger=pgtrigger.compiler.Trigger( | ||
name='update_asset_upload_trigger', | ||
sql=pgtrigger.compiler.UpsertTriggerSql( | ||
condition='WHEN (OLD.* IS DISTINCT FROM NEW.*)', | ||
func= | ||
'\n -- update AssetUpload auto variable\n NEW.etag = public.gen_random_uuid();\n\n RETURN NEW;\n ', | ||
hash='0a7f1aa8f8c0bb2c413a7ce626f75c8da5bf4b6d', | ||
operation='UPDATE', | ||
pgid='pgtrigger_update_asset_upload_trigger_8d012', | ||
table='stac_api_collectionassetupload', | ||
when='BEFORE' | ||
) | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.