From 054cfafccae2e5e7f33558a3b5e97cba3afbbaef Mon Sep 17 00:00:00 2001 From: Florian Knappers <73856313+JJFlorian@users.noreply.github.com> Date: Wed, 3 Apr 2024 17:39:26 +0200 Subject: [PATCH] linked gmn swagger typehint fix, upload task status options --- api/migrations/0026_alter_uploadtask_status.py | 18 ++++++++++++++++++ api/models.py | 4 +++- gmw/serializers.py | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 api/migrations/0026_alter_uploadtask_status.py diff --git a/api/migrations/0026_alter_uploadtask_status.py b/api/migrations/0026_alter_uploadtask_status.py new file mode 100644 index 0000000..2e68e5d --- /dev/null +++ b/api/migrations/0026_alter_uploadtask_status.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.1 on 2024-04-03 15:38 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0025_alter_importtask_progress'), + ] + + operations = [ + migrations.AlterField( + model_name='uploadtask', + name='status', + field=models.CharField(blank=True, choices=[('PENDING', 'Pending'), ('PROCESSING', 'Processing'), ('COMPLETED', 'Completed'), ('FAILED', 'Failed')], default='PENDING', max_length=20), + ), + ] diff --git a/api/models.py b/api/models.py index 9b182c5..b863fc0 100644 --- a/api/models.py +++ b/api/models.py @@ -76,7 +76,9 @@ class UploadTask(models.Model): ) metadata = JSONField("Metadata", default=dict, blank=False) sourcedocument_data = JSONField("Sourcedocument data", default=dict, blank=False) - status = models.CharField(max_length=500, blank=True, null=True) + status = models.CharField( + max_length=20, choices=choices.STATUS_CHOICES, default="PENDING", blank=True + ) bro_id = models.CharField(max_length=500, blank=True, null=True) log = models.TextField(blank=True) diff --git a/gmw/serializers.py b/gmw/serializers.py index e5415b4..498a28b 100644 --- a/gmw/serializers.py +++ b/gmw/serializers.py @@ -14,7 +14,7 @@ class Meta: model = gmw_models.GMW fields = "__all__" - def get_linked_gmns(self, obj): + def get_linked_gmns(self, obj) ->list: try: linked_gmns = set( measuringpoint.gmn.uuid