From 0f2349c683ba01c81320cc948ed41526a6beb66f Mon Sep 17 00:00:00 2001 From: ThibaultFy <50656860+ThibaultFy@users.noreply.github.com> Date: Mon, 25 Mar 2024 18:17:13 +0100 Subject: [PATCH] chore!: remove type in DataManager model (#860) Signed-off-by: ThibaultFy --- .../migrations/0059_remove_datamanager_type.py | 16 ++++++++++++++++ backend/api/models/datamanager.py | 1 - backend/api/serializers/datamanager.py | 1 - backend/api/tests/asset_factory.py | 2 -- .../api/tests/views/test_views_datamanager.py | 6 ------ changes/.gitkeep | 0 changes/860.changed | 1 + 7 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 backend/api/migrations/0059_remove_datamanager_type.py create mode 100644 changes/.gitkeep create mode 100644 changes/860.changed diff --git a/backend/api/migrations/0059_remove_datamanager_type.py b/backend/api/migrations/0059_remove_datamanager_type.py new file mode 100644 index 000000000..54f32edec --- /dev/null +++ b/backend/api/migrations/0059_remove_datamanager_type.py @@ -0,0 +1,16 @@ +# Generated by Django 4.2.9 on 2024-03-22 09:39 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("api", "0058_alter_compute_task_status"), + ] + + operations = [ + migrations.RemoveField( + model_name="datamanager", + name="type", + ), + ] diff --git a/backend/api/models/datamanager.py b/backend/api/models/datamanager.py index e2b38ce55..6b1001a55 100644 --- a/backend/api/models/datamanager.py +++ b/backend/api/models/datamanager.py @@ -20,7 +20,6 @@ class DataManager(models.Model, AssetPermissionMixin): permissions_process_authorized_ids = ArrayField(models.CharField(max_length=1024), size=100) logs_permission_public = models.BooleanField() logs_permission_authorized_ids = ArrayField(models.CharField(max_length=1024), size=100) - type = models.CharField(max_length=100) owner = models.CharField(max_length=100) creation_date = models.DateTimeField() metadata = models.JSONField() diff --git a/backend/api/serializers/datamanager.py b/backend/api/serializers/datamanager.py index bef0b095f..e3dec9bad 100644 --- a/backend/api/serializers/datamanager.py +++ b/backend/api/serializers/datamanager.py @@ -29,7 +29,6 @@ class Meta: "opener", "owner", "permissions", - "type", ] def to_representation(self, instance): diff --git a/backend/api/tests/asset_factory.py b/backend/api/tests/asset_factory.py index bda79bae1..2a7ad1cc1 100644 --- a/backend/api/tests/asset_factory.py +++ b/backend/api/tests/asset_factory.py @@ -262,7 +262,6 @@ def create_function( def create_datamanager( key: uuid.UUID = None, name: str = "datamanager", - type: str = "Test", metadata: dict = None, owner: str = DEFAULT_OWNER, channel: str = DEFAULT_CHANNEL, @@ -273,7 +272,6 @@ def create_datamanager( return DataManager.objects.create( key=key, name=name, - type=type, metadata=metadata or {}, opener_address=get_storage_address("data_manager", key, "opener"), opener_checksum=DUMMY_CHECKSUM, diff --git a/backend/api/tests/views/test_views_datamanager.py b/backend/api/tests/views/test_views_datamanager.py index e36fff8ab..48aa48039 100644 --- a/backend/api/tests/views/test_views_datamanager.py +++ b/backend/api/tests/views/test_views_datamanager.py @@ -75,7 +75,6 @@ def setUp(self): "authorized_ids": ["MyOrg1MSP"], }, }, - "type": "Test", "opener": { "checksum": "dummy-checksum", "storage_address": f"http://testserver/data_manager/{data_manager_1.key}/opener/", @@ -106,7 +105,6 @@ def setUp(self): "authorized_ids": ["MyOrg1MSP"], }, }, - "type": "Test", "opener": { "checksum": "dummy-checksum", "storage_address": f"http://testserver/data_manager/{data_manager_2.key}/opener/", @@ -137,7 +135,6 @@ def setUp(self): "authorized_ids": ["MyOrg1MSP"], }, }, - "type": "Test", "opener": { "checksum": "dummy-checksum", "storage_address": f"http://testserver/data_manager/{data_manager_3.key}/opener/", @@ -377,7 +374,6 @@ def mock_orc_response(data): "json": json.dumps( { "name": "Datamanager test", - "type": "Test", "permissions": { "public": True, "authorized_ids": ["MyOrg1MSP"], @@ -410,7 +406,6 @@ def test_file_size_limit(self): "json": json.dumps( { "name": "Datamanager test", - "type": "Test", "permissions": { "public": True, "authorized_ids": ["MyOrg1MSP"], @@ -447,7 +442,6 @@ def __init__(self) -> None: "json": json.dumps( { "name": "Datamanager test", - "type": "Test", "permissions": { "public": True, "authorized_ids": ["MyOrg1MSP"], diff --git a/changes/.gitkeep b/changes/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/changes/860.changed b/changes/860.changed new file mode 100644 index 000000000..6fee439a6 --- /dev/null +++ b/changes/860.changed @@ -0,0 +1 @@ +BREAKING: remove `type` from `datamanager` ([#860](https://github.com/Substra/substra-backend/pull/860/files)) \ No newline at end of file