From 610b609b5324cd50752a7a3e35be77cbc9b54e89 Mon Sep 17 00:00:00 2001 From: bart-maykin Date: Wed, 18 Oct 2023 11:39:04 +0200 Subject: [PATCH] :truck: [#59] moved the old api to legacy file --- .../components/contactmomenten/__init__.py | 1 - src/openklant/components/klanten/__init__.py | 1 - .../api => legacy}/__init__.py | 0 .../legacy/contactmomenten/__init__.py | 3 + .../{ => legacy}/contactmomenten/admin.py | 0 .../contactmomenten/api}/__init__.py | 0 .../contactmomenten/api/audits.py | 0 .../{ => legacy}/contactmomenten/api/auth.py | 0 .../contactmomenten/api/filters.py | 2 +- .../contactmomenten/api/kanalen.py | 4 +- .../contactmomenten/api/schema.py | 0 .../contactmomenten/api/scopes.py | 0 .../contactmomenten/api/serializers.py | 4 +- .../contactmomenten/api/tests}/__init__.py | 0 .../contactmomenten/api/tests/test_auth.py | 2 +- .../api/tests/test_contactmoment.py | 58 ++++---- .../api/tests/test_klantcontactmoment.py | 9 +- .../api/tests/test_objectcontactmoment.py | 32 ++--- .../contactmomenten/api/tests/test_urls.py | 0 .../contactmomenten/api/tests/views.py | 0 .../{ => legacy}/contactmomenten/api/urls.py | 0 .../{ => legacy}/contactmomenten/api/utils.py | 0 .../contactmomenten/api/validators.py | 2 +- .../contactmomenten/api/viewsets.py | 0 .../{ => legacy}/contactmomenten/apps.py | 2 +- .../migrations/0001_initial.py | 0 .../0002_klantcontactmoment_gelezen.py | 0 .../contactmomenten/migrations}/__init__.py | 0 .../contactmomenten/models}/__init__.py | 0 .../contactmomenten/models/constants.py | 0 .../contactmomenten/models/contactmomenten.py | 0 .../models/migrations}/__init__.py | 0 .../contactmomenten/models}/tests/__init__.py | 0 .../contactmomenten/models/tests/factories.py | 0 .../test_audittrail_unique_representation.py | 6 +- .../{ => legacy}/contactmomenten/openapi.yaml | 2 +- .../{ => legacy}/contactmomenten/resources.md | 0 .../contactmomenten/swagger2.0.json | 0 .../contactmomenten/tests}/__init__.py | 0 .../contactmomenten/tests/test_audittrails.py | 10 +- .../tests/test_notifications_kanaal.py | 4 +- .../tests/test_notifications_send.py | 4 +- .../contactmomenten/tests/utils.py | 0 .../components/legacy/klanten/__init__.py | 1 + .../components/{ => legacy}/klanten/admin.py | 0 .../tests => legacy/klanten/api}/__init__.py | 0 .../{ => legacy}/klanten/api/audits.py | 0 .../{ => legacy}/klanten/api/auth.py | 0 .../{ => legacy}/klanten/api/filters.py | 0 .../{ => legacy}/klanten/api/kanalen.py | 2 +- .../{ => legacy}/klanten/api/schema.py | 0 .../{ => legacy}/klanten/api/scopes.py | 0 .../{ => legacy}/klanten/api/serializers.py | 7 +- .../klanten/api/tests}/__init__.py | 0 .../klanten/api/tests/test_auth.py | 8 +- .../klanten/api/tests/test_klant.py | 6 +- .../klanten/api/tests/test_urls.py | 0 .../{ => legacy}/klanten/api/tests/views.py | 0 .../{ => legacy}/klanten/api/urls.py | 0 .../{ => legacy}/klanten/api/utils.py | 0 .../{ => legacy}/klanten/api/viewsets.py | 2 +- .../components/{ => legacy}/klanten/apps.py | 2 +- .../klanten/migrations/0001_initial.py | 0 .../migrations/0002_klant_aanmaakkanaal.py | 0 .../migrations/0003_auto_20211217_0958.py | 0 .../migrations/0004_klant_geverifieerd.py | 0 .../migrations/0005_auto_20230905_1215.py | 0 .../klanten/migrations}/__init__.py | 0 .../klanten/models}/__init__.py | 0 .../{ => legacy}/klanten/models/constants.py | 0 .../{ => legacy}/klanten/models/klanten.py | 0 .../klanten/models/migrations}/__init__.py | 0 .../klanten/models}/tests/__init__.py | 0 .../klanten/models/tests/factories.py | 0 .../test_audittrail_unique_representation.py | 0 .../{ => legacy}/klanten/openapi.yaml | 2 +- .../{ => legacy}/klanten/resources.md | 0 .../{ => legacy}/klanten/swagger2.0.json | 0 .../legacy/klanten/tests/__init__.py | 0 .../klanten/tests/test_audittrails.py | 0 .../tests/test_notifications_kanaal.py | 0 .../klanten/tests/test_notifications_send.py | 0 .../{ => legacy}/klanten/tests/utils.py | 0 src/openklant/conf/api.py | 4 +- src/openklant/conf/base.py | 20 ++- .../fixtures/default_admin_index.json | 134 ++++++++---------- src/openklant/urls.py | 5 +- src/openklant/utils/middleware.py | 10 +- 88 files changed, 185 insertions(+), 164 deletions(-) delete mode 100644 src/openklant/components/contactmomenten/__init__.py delete mode 100644 src/openklant/components/klanten/__init__.py rename src/openklant/components/{contactmomenten/api => legacy}/__init__.py (100%) create mode 100644 src/openklant/components/legacy/contactmomenten/__init__.py rename src/openklant/components/{ => legacy}/contactmomenten/admin.py (100%) rename src/openklant/components/{contactmomenten/api/tests => legacy/contactmomenten/api}/__init__.py (100%) rename src/openklant/components/{ => legacy}/contactmomenten/api/audits.py (100%) rename src/openklant/components/{ => legacy}/contactmomenten/api/auth.py (100%) rename src/openklant/components/{ => legacy}/contactmomenten/api/filters.py (98%) rename src/openklant/components/{ => legacy}/contactmomenten/api/kanalen.py (71%) rename src/openklant/components/{ => legacy}/contactmomenten/api/schema.py (100%) rename src/openklant/components/{ => legacy}/contactmomenten/api/scopes.py (100%) rename src/openklant/components/{ => legacy}/contactmomenten/api/serializers.py (97%) rename src/openklant/components/{contactmomenten/migrations => legacy/contactmomenten/api/tests}/__init__.py (100%) rename src/openklant/components/{ => legacy}/contactmomenten/api/tests/test_auth.py (90%) rename src/openklant/components/{ => legacy}/contactmomenten/api/tests/test_contactmoment.py (95%) rename src/openklant/components/{ => legacy}/contactmomenten/api/tests/test_klantcontactmoment.py (97%) rename src/openklant/components/{ => legacy}/contactmomenten/api/tests/test_objectcontactmoment.py (88%) rename src/openklant/components/{ => legacy}/contactmomenten/api/tests/test_urls.py (100%) rename src/openklant/components/{ => legacy}/contactmomenten/api/tests/views.py (100%) rename src/openklant/components/{ => legacy}/contactmomenten/api/urls.py (100%) rename src/openklant/components/{ => legacy}/contactmomenten/api/utils.py (100%) rename src/openklant/components/{ => legacy}/contactmomenten/api/validators.py (97%) rename src/openklant/components/{ => legacy}/contactmomenten/api/viewsets.py (100%) rename src/openklant/components/{ => legacy}/contactmomenten/apps.py (57%) rename src/openklant/components/{ => legacy}/contactmomenten/migrations/0001_initial.py (100%) rename src/openklant/components/{ => legacy}/contactmomenten/migrations/0002_klantcontactmoment_gelezen.py (100%) rename src/openklant/components/{contactmomenten/models => legacy/contactmomenten/migrations}/__init__.py (100%) rename src/openklant/components/{contactmomenten/models/migrations => legacy/contactmomenten/models}/__init__.py (100%) rename src/openklant/components/{ => legacy}/contactmomenten/models/constants.py (100%) rename src/openklant/components/{ => legacy}/contactmomenten/models/contactmomenten.py (100%) rename src/openklant/components/{contactmomenten/models/tests => legacy/contactmomenten/models/migrations}/__init__.py (100%) rename src/openklant/components/{contactmomenten => legacy/contactmomenten/models}/tests/__init__.py (100%) rename src/openklant/components/{ => legacy}/contactmomenten/models/tests/factories.py (100%) rename src/openklant/components/{ => legacy}/contactmomenten/models/tests/test_audittrail_unique_representation.py (84%) rename src/openklant/components/{ => legacy}/contactmomenten/openapi.yaml (99%) rename src/openklant/components/{ => legacy}/contactmomenten/resources.md (100%) rename src/openklant/components/{ => legacy}/contactmomenten/swagger2.0.json (100%) rename src/openklant/components/{klanten/api => legacy/contactmomenten/tests}/__init__.py (100%) rename src/openklant/components/{ => legacy}/contactmomenten/tests/test_audittrails.py (92%) rename src/openklant/components/{ => legacy}/contactmomenten/tests/test_notifications_kanaal.py (96%) rename src/openklant/components/{ => legacy}/contactmomenten/tests/test_notifications_send.py (95%) rename src/openklant/components/{ => legacy}/contactmomenten/tests/utils.py (100%) create mode 100644 src/openklant/components/legacy/klanten/__init__.py rename src/openklant/components/{ => legacy}/klanten/admin.py (100%) rename src/openklant/components/{klanten/api/tests => legacy/klanten/api}/__init__.py (100%) rename src/openklant/components/{ => legacy}/klanten/api/audits.py (100%) rename src/openklant/components/{ => legacy}/klanten/api/auth.py (100%) rename src/openklant/components/{ => legacy}/klanten/api/filters.py (100%) rename src/openklant/components/{ => legacy}/klanten/api/kanalen.py (75%) rename src/openklant/components/{ => legacy}/klanten/api/schema.py (100%) rename src/openklant/components/{ => legacy}/klanten/api/scopes.py (100%) rename src/openklant/components/{ => legacy}/klanten/api/serializers.py (98%) rename src/openklant/components/{klanten/migrations => legacy/klanten/api/tests}/__init__.py (100%) rename src/openklant/components/{ => legacy}/klanten/api/tests/test_auth.py (87%) rename src/openklant/components/{ => legacy}/klanten/api/tests/test_klant.py (99%) rename src/openklant/components/{ => legacy}/klanten/api/tests/test_urls.py (100%) rename src/openklant/components/{ => legacy}/klanten/api/tests/views.py (100%) rename src/openklant/components/{ => legacy}/klanten/api/urls.py (100%) rename src/openklant/components/{ => legacy}/klanten/api/utils.py (100%) rename src/openklant/components/{ => legacy}/klanten/api/viewsets.py (97%) rename src/openklant/components/{ => legacy}/klanten/apps.py (58%) rename src/openklant/components/{ => legacy}/klanten/migrations/0001_initial.py (100%) rename src/openklant/components/{ => legacy}/klanten/migrations/0002_klant_aanmaakkanaal.py (100%) rename src/openklant/components/{ => legacy}/klanten/migrations/0003_auto_20211217_0958.py (100%) rename src/openklant/components/{ => legacy}/klanten/migrations/0004_klant_geverifieerd.py (100%) rename src/openklant/components/{ => legacy}/klanten/migrations/0005_auto_20230905_1215.py (100%) rename src/openklant/components/{klanten/models => legacy/klanten/migrations}/__init__.py (100%) rename src/openklant/components/{klanten/models/migrations => legacy/klanten/models}/__init__.py (100%) rename src/openklant/components/{ => legacy}/klanten/models/constants.py (100%) rename src/openklant/components/{ => legacy}/klanten/models/klanten.py (100%) rename src/openklant/components/{klanten/models/tests => legacy/klanten/models/migrations}/__init__.py (100%) rename src/openklant/components/{klanten => legacy/klanten/models}/tests/__init__.py (100%) rename src/openklant/components/{ => legacy}/klanten/models/tests/factories.py (100%) rename src/openklant/components/{ => legacy}/klanten/models/tests/test_audittrail_unique_representation.py (100%) rename src/openklant/components/{ => legacy}/klanten/openapi.yaml (99%) rename src/openklant/components/{ => legacy}/klanten/resources.md (100%) rename src/openklant/components/{ => legacy}/klanten/swagger2.0.json (100%) create mode 100644 src/openklant/components/legacy/klanten/tests/__init__.py rename src/openklant/components/{ => legacy}/klanten/tests/test_audittrails.py (100%) rename src/openklant/components/{ => legacy}/klanten/tests/test_notifications_kanaal.py (100%) rename src/openklant/components/{ => legacy}/klanten/tests/test_notifications_send.py (100%) rename src/openklant/components/{ => legacy}/klanten/tests/utils.py (100%) diff --git a/src/openklant/components/contactmomenten/__init__.py b/src/openklant/components/contactmomenten/__init__.py deleted file mode 100644 index dcf452a4..00000000 --- a/src/openklant/components/contactmomenten/__init__.py +++ /dev/null @@ -1 +0,0 @@ -default_app_config = "openklant.components.contactmomenten.apps.ContactmomentenConfig" diff --git a/src/openklant/components/klanten/__init__.py b/src/openklant/components/klanten/__init__.py deleted file mode 100644 index 71cbe7e4..00000000 --- a/src/openklant/components/klanten/__init__.py +++ /dev/null @@ -1 +0,0 @@ -default_app_config = "openklant.components.klanten.apps.KlantenConfig" diff --git a/src/openklant/components/contactmomenten/api/__init__.py b/src/openklant/components/legacy/__init__.py similarity index 100% rename from src/openklant/components/contactmomenten/api/__init__.py rename to src/openklant/components/legacy/__init__.py diff --git a/src/openklant/components/legacy/contactmomenten/__init__.py b/src/openklant/components/legacy/contactmomenten/__init__.py new file mode 100644 index 00000000..d126caf5 --- /dev/null +++ b/src/openklant/components/legacy/contactmomenten/__init__.py @@ -0,0 +1,3 @@ +default_app_config = ( + "openklant.components.legacy.contactmomenten.apps.ContactmomentenConfig" +) diff --git a/src/openklant/components/contactmomenten/admin.py b/src/openklant/components/legacy/contactmomenten/admin.py similarity index 100% rename from src/openklant/components/contactmomenten/admin.py rename to src/openklant/components/legacy/contactmomenten/admin.py diff --git a/src/openklant/components/contactmomenten/api/tests/__init__.py b/src/openklant/components/legacy/contactmomenten/api/__init__.py similarity index 100% rename from src/openklant/components/contactmomenten/api/tests/__init__.py rename to src/openklant/components/legacy/contactmomenten/api/__init__.py diff --git a/src/openklant/components/contactmomenten/api/audits.py b/src/openklant/components/legacy/contactmomenten/api/audits.py similarity index 100% rename from src/openklant/components/contactmomenten/api/audits.py rename to src/openklant/components/legacy/contactmomenten/api/audits.py diff --git a/src/openklant/components/contactmomenten/api/auth.py b/src/openklant/components/legacy/contactmomenten/api/auth.py similarity index 100% rename from src/openklant/components/contactmomenten/api/auth.py rename to src/openklant/components/legacy/contactmomenten/api/auth.py diff --git a/src/openklant/components/contactmomenten/api/filters.py b/src/openklant/components/legacy/contactmomenten/api/filters.py similarity index 98% rename from src/openklant/components/contactmomenten/api/filters.py rename to src/openklant/components/legacy/contactmomenten/api/filters.py index d87f7c71..5fca4b20 100644 --- a/src/openklant/components/contactmomenten/api/filters.py +++ b/src/openklant/components/legacy/contactmomenten/api/filters.py @@ -5,7 +5,7 @@ from vng_api_common.filtersets import FilterSet from vng_api_common.utils import get_help_text -from openklant.components.contactmomenten.models.contactmomenten import ( +from openklant.components.legacy.contactmomenten.models.contactmomenten import ( ContactMoment, KlantContactMoment, ObjectContactMoment, diff --git a/src/openklant/components/contactmomenten/api/kanalen.py b/src/openklant/components/legacy/contactmomenten/api/kanalen.py similarity index 71% rename from src/openklant/components/contactmomenten/api/kanalen.py rename to src/openklant/components/legacy/contactmomenten/api/kanalen.py index 537fe0c1..6b9b150e 100644 --- a/src/openklant/components/contactmomenten/api/kanalen.py +++ b/src/openklant/components/legacy/contactmomenten/api/kanalen.py @@ -2,7 +2,9 @@ from notifications_api_common.kanalen import Kanaal -from openklant.components.contactmomenten.models.contactmomenten import ContactMoment +from openklant.components.legacy.contactmomenten.models.contactmomenten import ( + ContactMoment, +) KANAAL_CONTACTMOMENTEN = Kanaal( settings.CONTACTMOMENTEN_NOTIFICATIONS_KANAAL, diff --git a/src/openklant/components/contactmomenten/api/schema.py b/src/openklant/components/legacy/contactmomenten/api/schema.py similarity index 100% rename from src/openklant/components/contactmomenten/api/schema.py rename to src/openklant/components/legacy/contactmomenten/api/schema.py diff --git a/src/openklant/components/contactmomenten/api/scopes.py b/src/openklant/components/legacy/contactmomenten/api/scopes.py similarity index 100% rename from src/openklant/components/contactmomenten/api/scopes.py rename to src/openklant/components/legacy/contactmomenten/api/scopes.py diff --git a/src/openklant/components/contactmomenten/api/serializers.py b/src/openklant/components/legacy/contactmomenten/api/serializers.py similarity index 97% rename from src/openklant/components/contactmomenten/api/serializers.py rename to src/openklant/components/legacy/contactmomenten/api/serializers.py index b125df74..b98266cc 100644 --- a/src/openklant/components/contactmomenten/api/serializers.py +++ b/src/openklant/components/legacy/contactmomenten/api/serializers.py @@ -8,8 +8,8 @@ from vng_api_common.serializers import add_choice_values_help_text from vng_api_common.validators import IsImmutableValidator, URLValidator -from openklant.components.contactmomenten.models.constants import ObjectTypes -from openklant.components.contactmomenten.models.contactmomenten import ( +from openklant.components.legacy.contactmomenten.models.constants import ObjectTypes +from openklant.components.legacy.contactmomenten.models.contactmomenten import ( ContactMoment, KlantContactMoment, Medewerker, diff --git a/src/openklant/components/contactmomenten/migrations/__init__.py b/src/openklant/components/legacy/contactmomenten/api/tests/__init__.py similarity index 100% rename from src/openklant/components/contactmomenten/migrations/__init__.py rename to src/openklant/components/legacy/contactmomenten/api/tests/__init__.py diff --git a/src/openklant/components/contactmomenten/api/tests/test_auth.py b/src/openklant/components/legacy/contactmomenten/api/tests/test_auth.py similarity index 90% rename from src/openklant/components/contactmomenten/api/tests/test_auth.py rename to src/openklant/components/legacy/contactmomenten/api/tests/test_auth.py index ed96749f..abe31e56 100644 --- a/src/openklant/components/contactmomenten/api/tests/test_auth.py +++ b/src/openklant/components/legacy/contactmomenten/api/tests/test_auth.py @@ -4,7 +4,7 @@ from rest_framework.test import APITestCase from vng_api_common.tests import AuthCheckMixin, reverse -from openklant.components.contactmomenten.models.tests.factories import ( +from openklant.components.legacy.contactmomenten.models.tests.factories import ( ContactMomentFactory, ) diff --git a/src/openklant/components/contactmomenten/api/tests/test_contactmoment.py b/src/openklant/components/legacy/contactmomenten/api/tests/test_contactmoment.py similarity index 95% rename from src/openklant/components/contactmomenten/api/tests/test_contactmoment.py rename to src/openklant/components/legacy/contactmomenten/api/tests/test_contactmoment.py index 7fc2e889..d03cbf88 100644 --- a/src/openklant/components/contactmomenten/api/tests/test_contactmoment.py +++ b/src/openklant/components/legacy/contactmomenten/api/tests/test_contactmoment.py @@ -7,9 +7,11 @@ from vng_api_common.constants import ComponentTypes from vng_api_common.tests import JWTAuthMixin, get_validation_errors, reverse -from openklant.components.contactmomenten.models.constants import InitiatiefNemer -from openklant.components.contactmomenten.models.contactmomenten import ContactMoment -from openklant.components.contactmomenten.models.tests.factories import ( +from openklant.components.legacy.contactmomenten.models.constants import InitiatiefNemer +from openklant.components.legacy.contactmomenten.models.contactmomenten import ( + ContactMoment, +) +from openklant.components.legacy.contactmomenten.models.tests.factories import ( ContactMomentFactory, KlantContactMomentFactory, MedewerkerFactory, @@ -18,7 +20,7 @@ from ..scopes import SCOPE_CONTACTMOMENTEN_AANMAKEN, SCOPE_CONTACTMOMENTEN_ALLES_LEZEN -KLANT = "http://klanten.nl/api/v1/klanten/12345" +KLANT = "http://klanten.nl/api/v0/klanten/12345" class ContactMomentTests(JWTAuthMixin, APITestCase): @@ -770,18 +772,18 @@ def test_filter_object_url(self): cm3 = ContactMomentFactory.create(kanaal="email") ObjectContactMomentFactory.create( - contactmoment=cm1, object="http://example.com/api/v1/1" + contactmoment=cm1, object="http://example.com/api/v0/1" ) ObjectContactMomentFactory.create( - contactmoment=cm2, object="http://example.com/api/v1/2" + contactmoment=cm2, object="http://example.com/api/v0/2" ) ObjectContactMomentFactory.create( - contactmoment=cm3, object="http://example.com/api/v1/2" + contactmoment=cm3, object="http://example.com/api/v0/2" ) response = self.client.get( self.list_url, - {"object": "http://example.com/api/v1/2"}, + {"object": "http://example.com/api/v0/2"}, HTTP_HOST="testserver.com", ) @@ -802,18 +804,18 @@ def test_filter_object_url_multiple(self): cm3 = ContactMomentFactory.create(kanaal="email") ObjectContactMomentFactory.create( - contactmoment=cm1, object="http://example.com/api/v1/1" + contactmoment=cm1, object="http://example.com/api/v0/1" ) ObjectContactMomentFactory.create( - contactmoment=cm2, object="http://example.com/api/v1/2" + contactmoment=cm2, object="http://example.com/api/v0/2" ) ObjectContactMomentFactory.create( - contactmoment=cm3, object="http://example.com/api/v1/3" + contactmoment=cm3, object="http://example.com/api/v0/3" ) response = self.client.get( self.list_url, - {"object": "http://example.com/api/v1/2,http://example.com/api/v1/3"}, + {"object": "http://example.com/api/v0/2,http://example.com/api/v0/3"}, HTTP_HOST="testserver.com", ) @@ -834,18 +836,18 @@ def test_filter_klant_url(self): cm3 = ContactMomentFactory.create(kanaal="email") KlantContactMomentFactory.create( - contactmoment=cm1, klant="http://example.com/api/v1/1" + contactmoment=cm1, klant="http://example.com/api/v0/1" ) KlantContactMomentFactory.create( - contactmoment=cm2, klant="http://example.com/api/v1/2" + contactmoment=cm2, klant="http://example.com/api/v0/2" ) KlantContactMomentFactory.create( - contactmoment=cm3, klant="http://example.com/api/v1/2" + contactmoment=cm3, klant="http://example.com/api/v0/2" ) response = self.client.get( self.list_url, - {"klant": "http://example.com/api/v1/2"}, + {"klant": "http://example.com/api/v0/2"}, HTTP_HOST="testserver.com", ) @@ -866,18 +868,18 @@ def test_filter_klant_url_multiple(self): cm3 = ContactMomentFactory.create(kanaal="email") KlantContactMomentFactory.create( - contactmoment=cm1, klant="http://example.com/api/v1/1" + contactmoment=cm1, klant="http://example.com/api/v0/1" ) KlantContactMomentFactory.create( - contactmoment=cm2, klant="http://example.com/api/v1/2" + contactmoment=cm2, klant="http://example.com/api/v0/2" ) KlantContactMomentFactory.create( - contactmoment=cm3, klant="http://example.com/api/v1/3" + contactmoment=cm3, klant="http://example.com/api/v0/3" ) response = self.client.get( self.list_url, - {"klant": "http://example.com/api/v1/2,http://example.com/api/v1/3"}, + {"klant": "http://example.com/api/v0/2,http://example.com/api/v0/3"}, HTTP_HOST="testserver.com", ) @@ -898,29 +900,29 @@ def test_filter_klant_url_and_object_url(self): cm3 = ContactMomentFactory.create(kanaal="email") KlantContactMomentFactory.create( - contactmoment=cm1, klant="http://example.com/api/v1/1" + contactmoment=cm1, klant="http://example.com/api/v0/1" ) KlantContactMomentFactory.create( - contactmoment=cm2, klant="http://example.com/api/v1/2" + contactmoment=cm2, klant="http://example.com/api/v0/2" ) KlantContactMomentFactory.create( - contactmoment=cm3, klant="http://example.com/api/v1/2" + contactmoment=cm3, klant="http://example.com/api/v0/2" ) ObjectContactMomentFactory.create( - contactmoment=cm1, object="http://example.com/api/v1/1" + contactmoment=cm1, object="http://example.com/api/v0/1" ) ObjectContactMomentFactory.create( - contactmoment=cm2, object="http://example.com/api/v1/2" + contactmoment=cm2, object="http://example.com/api/v0/2" ) ObjectContactMomentFactory.create( - contactmoment=cm3, object="http://example.com/api/v1/3" + contactmoment=cm3, object="http://example.com/api/v0/3" ) response = self.client.get( self.list_url, { - "klant": "http://example.com/api/v1/2", - "object": "http://example.com/api/v1/3", + "klant": "http://example.com/api/v0/2", + "object": "http://example.com/api/v0/3", }, HTTP_HOST="testserver.com", ) diff --git a/src/openklant/components/contactmomenten/api/tests/test_klantcontactmoment.py b/src/openklant/components/legacy/contactmomenten/api/tests/test_klantcontactmoment.py similarity index 97% rename from src/openklant/components/contactmomenten/api/tests/test_klantcontactmoment.py rename to src/openklant/components/legacy/contactmomenten/api/tests/test_klantcontactmoment.py index 04e2040e..7c21cd3f 100644 --- a/src/openklant/components/contactmomenten/api/tests/test_klantcontactmoment.py +++ b/src/openklant/components/legacy/contactmomenten/api/tests/test_klantcontactmoment.py @@ -8,11 +8,14 @@ from vng_api_common.models import APICredential from vng_api_common.tests import JWTAuthMixin, get_validation_errors, reverse -from openklant.components.contactmomenten.models.constants import InitiatiefNemer, Rol -from openklant.components.contactmomenten.models.contactmomenten import ( +from openklant.components.legacy.contactmomenten.models.constants import ( + InitiatiefNemer, + Rol, +) +from openklant.components.legacy.contactmomenten.models.contactmomenten import ( KlantContactMoment, ) -from openklant.components.contactmomenten.models.tests.factories import ( +from openklant.components.legacy.contactmomenten.models.tests.factories import ( ContactMomentFactory, KlantContactMomentFactory, ) diff --git a/src/openklant/components/contactmomenten/api/tests/test_objectcontactmoment.py b/src/openklant/components/legacy/contactmomenten/api/tests/test_objectcontactmoment.py similarity index 88% rename from src/openklant/components/contactmomenten/api/tests/test_objectcontactmoment.py rename to src/openklant/components/legacy/contactmomenten/api/tests/test_objectcontactmoment.py index fe8a71a5..9d7406b2 100644 --- a/src/openklant/components/contactmomenten/api/tests/test_objectcontactmoment.py +++ b/src/openklant/components/legacy/contactmomenten/api/tests/test_objectcontactmoment.py @@ -8,16 +8,16 @@ from vng_api_common.tests import JWTAuthMixin, get_validation_errors, reverse from zds_client.tests.mocks import mock_client -from openklant.components.contactmomenten.models.constants import ObjectTypes -from openklant.components.contactmomenten.models.contactmomenten import ( +from openklant.components.legacy.contactmomenten.models.constants import ObjectTypes +from openklant.components.legacy.contactmomenten.models.contactmomenten import ( ObjectContactMoment, ) -from openklant.components.contactmomenten.models.tests.factories import ( +from openklant.components.legacy.contactmomenten.models.tests.factories import ( ContactMomentFactory, ObjectContactMomentFactory, ) -ZAAK = "http://example.com/api/v1/zaken/1" +ZAAK = "http://example.com/api/v0/zaken/1" class ObjectContactMomentTests(JWTAuthMixin, APITestCase): @@ -63,7 +63,7 @@ def test_read_objectcontactmoment(self): ) @patch( "zds_client.client.get_operation_url", - return_value="/api/v1/zaakcontactmomenten", + return_value="/api/v0/zaakcontactmomenten", ) @patch("zds_client.tests.mocks.MockClient.fetch_schema", return_value={}) @patch("vng_api_common.validators.obj_has_shape", return_value=True) @@ -77,10 +77,10 @@ def test_create_objectcontactmoment(self, *mocks): "object": ZAAK, } responses = { - "http://example.com/api/v1/zaakcontactmomenten": [ + "http://example.com/api/v0/zaakcontactmomenten": [ { - "url": f"https://example.com/api/v1/zaakcontactmomenten/{uuid.uuid4()}", - "contactmoment": f"http://testserver/api/v1/contactmomenten/{uuid.uuid4()}", + "url": f"https://example.com/api/v0/zaakcontactmomenten/{uuid.uuid4()}", + "contactmoment": f"http://testserver/api/v0/contactmomenten/{uuid.uuid4()}", "zaak": ZAAK, } ] @@ -101,7 +101,7 @@ def test_create_objectcontactmoment(self, *mocks): ) @patch( "zds_client.client.get_operation_url", - return_value="/api/v1/zaakcontactmomenten", + return_value="/api/v0/zaakcontactmomenten", ) @patch("zds_client.tests.mocks.MockClient.fetch_schema", return_value={}) @patch("vng_api_common.validators.obj_has_shape", return_value=True) @@ -114,7 +114,7 @@ def test_create_objectcontactmoment_fail_no_remote_relation(self, *mocks): "objectType": ObjectTypes.zaak, "object": ZAAK, } - responses = {"http://example.com/api/v1/zaakcontactmomenten": []} + responses = {"http://example.com/api/v0/zaakcontactmomenten": []} with mock_client(responses): response = self.client.post(list_url, data) @@ -126,7 +126,7 @@ def test_create_objectcontactmoment_fail_no_remote_relation(self, *mocks): @patch( "zds_client.client.get_operation_url", - return_value="/api/v1/zaakcontactmomenten", + return_value="/api/v0/zaakcontactmomenten", ) @patch("zds_client.tests.mocks.MockClient.fetch_schema", return_value={}) def test_destroy_objectcontactmoment(self, *mocks): @@ -134,7 +134,7 @@ def test_destroy_objectcontactmoment(self, *mocks): object=ZAAK, object_type=ObjectTypes.zaak ) detail_url = reverse(objectcontactmoment) - responses = {"http://example.com/api/v1/zaakcontactmomenten": []} + responses = {"http://example.com/api/v0/zaakcontactmomenten": []} with mock_client(responses): response = self.client.delete(detail_url) @@ -144,7 +144,7 @@ def test_destroy_objectcontactmoment(self, *mocks): @patch( "zds_client.client.get_operation_url", - return_value="/api/v1/zaakcontactmomenten", + return_value="/api/v0/zaakcontactmomenten", ) @patch("zds_client.tests.mocks.MockClient.fetch_schema", return_value={}) def test_destroy_fail_existing_relation(self, *mocks): @@ -153,10 +153,10 @@ def test_destroy_fail_existing_relation(self, *mocks): ) detail_url = reverse(objectcontactmoment) responses = { - "http://example.com/api/v1/zaakcontactmomenten": [ + "http://example.com/api/v0/zaakcontactmomenten": [ { - "url": f"https://example.com/api/v1/zaakcontactmomenten/{uuid.uuid4()}", - "contactmoment": f"http://testserver/api/v1/contactmomenten/{uuid.uuid4()}", + "url": f"https://example.com/api/v0/zaakcontactmomenten/{uuid.uuid4()}", + "contactmoment": f"http://testserver/api/v0/contactmomenten/{uuid.uuid4()}", "zaak": ZAAK, } ] diff --git a/src/openklant/components/contactmomenten/api/tests/test_urls.py b/src/openklant/components/legacy/contactmomenten/api/tests/test_urls.py similarity index 100% rename from src/openklant/components/contactmomenten/api/tests/test_urls.py rename to src/openklant/components/legacy/contactmomenten/api/tests/test_urls.py diff --git a/src/openklant/components/contactmomenten/api/tests/views.py b/src/openklant/components/legacy/contactmomenten/api/tests/views.py similarity index 100% rename from src/openklant/components/contactmomenten/api/tests/views.py rename to src/openklant/components/legacy/contactmomenten/api/tests/views.py diff --git a/src/openklant/components/contactmomenten/api/urls.py b/src/openklant/components/legacy/contactmomenten/api/urls.py similarity index 100% rename from src/openklant/components/contactmomenten/api/urls.py rename to src/openklant/components/legacy/contactmomenten/api/urls.py diff --git a/src/openklant/components/contactmomenten/api/utils.py b/src/openklant/components/legacy/contactmomenten/api/utils.py similarity index 100% rename from src/openklant/components/contactmomenten/api/utils.py rename to src/openklant/components/legacy/contactmomenten/api/utils.py diff --git a/src/openklant/components/contactmomenten/api/validators.py b/src/openklant/components/legacy/contactmomenten/api/validators.py similarity index 97% rename from src/openklant/components/contactmomenten/api/validators.py rename to src/openklant/components/legacy/contactmomenten/api/validators.py index cbcdb2d6..d8062763 100644 --- a/src/openklant/components/contactmomenten/api/validators.py +++ b/src/openklant/components/legacy/contactmomenten/api/validators.py @@ -9,7 +9,7 @@ from vng_api_common.validators import ResourceValidator from zds_client import ClientError -from openklant.components.contactmomenten.models.contactmomenten import ( +from openklant.components.legacy.contactmomenten.models.contactmomenten import ( ObjectContactMoment, ) diff --git a/src/openklant/components/contactmomenten/api/viewsets.py b/src/openklant/components/legacy/contactmomenten/api/viewsets.py similarity index 100% rename from src/openklant/components/contactmomenten/api/viewsets.py rename to src/openklant/components/legacy/contactmomenten/api/viewsets.py diff --git a/src/openklant/components/contactmomenten/apps.py b/src/openklant/components/legacy/contactmomenten/apps.py similarity index 57% rename from src/openklant/components/contactmomenten/apps.py rename to src/openklant/components/legacy/contactmomenten/apps.py index ff88d7f3..4670c9df 100644 --- a/src/openklant/components/contactmomenten/apps.py +++ b/src/openklant/components/legacy/contactmomenten/apps.py @@ -2,4 +2,4 @@ class ContactmomentenConfig(AppConfig): - name = "openklant.components.contactmomenten" + name = "openklant.components.legacy.contactmomenten" diff --git a/src/openklant/components/contactmomenten/migrations/0001_initial.py b/src/openklant/components/legacy/contactmomenten/migrations/0001_initial.py similarity index 100% rename from src/openklant/components/contactmomenten/migrations/0001_initial.py rename to src/openklant/components/legacy/contactmomenten/migrations/0001_initial.py diff --git a/src/openklant/components/contactmomenten/migrations/0002_klantcontactmoment_gelezen.py b/src/openklant/components/legacy/contactmomenten/migrations/0002_klantcontactmoment_gelezen.py similarity index 100% rename from src/openklant/components/contactmomenten/migrations/0002_klantcontactmoment_gelezen.py rename to src/openklant/components/legacy/contactmomenten/migrations/0002_klantcontactmoment_gelezen.py diff --git a/src/openklant/components/contactmomenten/models/__init__.py b/src/openklant/components/legacy/contactmomenten/migrations/__init__.py similarity index 100% rename from src/openklant/components/contactmomenten/models/__init__.py rename to src/openklant/components/legacy/contactmomenten/migrations/__init__.py diff --git a/src/openklant/components/contactmomenten/models/migrations/__init__.py b/src/openklant/components/legacy/contactmomenten/models/__init__.py similarity index 100% rename from src/openklant/components/contactmomenten/models/migrations/__init__.py rename to src/openklant/components/legacy/contactmomenten/models/__init__.py diff --git a/src/openklant/components/contactmomenten/models/constants.py b/src/openklant/components/legacy/contactmomenten/models/constants.py similarity index 100% rename from src/openklant/components/contactmomenten/models/constants.py rename to src/openklant/components/legacy/contactmomenten/models/constants.py diff --git a/src/openklant/components/contactmomenten/models/contactmomenten.py b/src/openklant/components/legacy/contactmomenten/models/contactmomenten.py similarity index 100% rename from src/openklant/components/contactmomenten/models/contactmomenten.py rename to src/openklant/components/legacy/contactmomenten/models/contactmomenten.py diff --git a/src/openklant/components/contactmomenten/models/tests/__init__.py b/src/openklant/components/legacy/contactmomenten/models/migrations/__init__.py similarity index 100% rename from src/openklant/components/contactmomenten/models/tests/__init__.py rename to src/openklant/components/legacy/contactmomenten/models/migrations/__init__.py diff --git a/src/openklant/components/contactmomenten/tests/__init__.py b/src/openklant/components/legacy/contactmomenten/models/tests/__init__.py similarity index 100% rename from src/openklant/components/contactmomenten/tests/__init__.py rename to src/openklant/components/legacy/contactmomenten/models/tests/__init__.py diff --git a/src/openklant/components/contactmomenten/models/tests/factories.py b/src/openklant/components/legacy/contactmomenten/models/tests/factories.py similarity index 100% rename from src/openklant/components/contactmomenten/models/tests/factories.py rename to src/openklant/components/legacy/contactmomenten/models/tests/factories.py diff --git a/src/openklant/components/contactmomenten/models/tests/test_audittrail_unique_representation.py b/src/openklant/components/legacy/contactmomenten/models/tests/test_audittrail_unique_representation.py similarity index 84% rename from src/openklant/components/contactmomenten/models/tests/test_audittrail_unique_representation.py rename to src/openklant/components/legacy/contactmomenten/models/tests/test_audittrail_unique_representation.py index 36974216..33cb20da 100644 --- a/src/openklant/components/contactmomenten/models/tests/test_audittrail_unique_representation.py +++ b/src/openklant/components/legacy/contactmomenten/models/tests/test_audittrail_unique_representation.py @@ -4,10 +4,10 @@ from .factories import ContactMomentFactory -KLANT = "http://some.klanten.nl/api/v1/klanten/951e4660-3835-4643-8f9c-e523e364a30f" -ZAAK = "http://some.zrc.nl/api/v1/zaken/ffb1a466-fdad-4898-87fa-dae026df38c0" +KLANT = "http://some.klanten.nl/api/v0/klanten/951e4660-3835-4643-8f9c-e523e364a30f" +ZAAK = "http://some.zrc.nl/api/v0/zaken/ffb1a466-fdad-4898-87fa-dae026df38c0" MEDEWERKER = ( - "http://some.klanten.nl/api/v1/medewerkers/951e4660-3835-4643-8f9c-e523e364a30f" + "http://some.klanten.nl/api/v0/medewerkers/951e4660-3835-4643-8f9c-e523e364a30f" ) diff --git a/src/openklant/components/contactmomenten/openapi.yaml b/src/openklant/components/legacy/contactmomenten/openapi.yaml similarity index 99% rename from src/openklant/components/contactmomenten/openapi.yaml rename to src/openklant/components/legacy/contactmomenten/openapi.yaml index 2e227d12..89a63dc6 100644 --- a/src/openklant/components/contactmomenten/openapi.yaml +++ b/src/openklant/components/legacy/contactmomenten/openapi.yaml @@ -1435,7 +1435,7 @@ paths: type: string format: uuid servers: -- url: /contactmomenten/api/v1 +- url: /contactmomenten/api/v0 components: responses: '400': diff --git a/src/openklant/components/contactmomenten/resources.md b/src/openklant/components/legacy/contactmomenten/resources.md similarity index 100% rename from src/openklant/components/contactmomenten/resources.md rename to src/openklant/components/legacy/contactmomenten/resources.md diff --git a/src/openklant/components/contactmomenten/swagger2.0.json b/src/openklant/components/legacy/contactmomenten/swagger2.0.json similarity index 100% rename from src/openklant/components/contactmomenten/swagger2.0.json rename to src/openklant/components/legacy/contactmomenten/swagger2.0.json diff --git a/src/openklant/components/klanten/api/__init__.py b/src/openklant/components/legacy/contactmomenten/tests/__init__.py similarity index 100% rename from src/openklant/components/klanten/api/__init__.py rename to src/openklant/components/legacy/contactmomenten/tests/__init__.py diff --git a/src/openklant/components/contactmomenten/tests/test_audittrails.py b/src/openklant/components/legacy/contactmomenten/tests/test_audittrails.py similarity index 92% rename from src/openklant/components/contactmomenten/tests/test_audittrails.py rename to src/openklant/components/legacy/contactmomenten/tests/test_audittrails.py index 73fbf64d..980fd222 100644 --- a/src/openklant/components/contactmomenten/tests/test_audittrails.py +++ b/src/openklant/components/legacy/contactmomenten/tests/test_audittrails.py @@ -5,12 +5,14 @@ from vng_api_common.audittrails.models import AuditTrail from vng_api_common.tests import JWTAuthMixin, reverse -from openklant.components.contactmomenten.models.constants import InitiatiefNemer -from openklant.components.contactmomenten.models.contactmomenten import ContactMoment +from openklant.components.legacy.contactmomenten.models.constants import InitiatiefNemer +from openklant.components.legacy.contactmomenten.models.contactmomenten import ( + ContactMoment, +) -KLANT = "http://some.klanten.nl/api/v1/klanten/951e4660-3835-4643-8f9c-e523e364a30f" +KLANT = "http://some.klanten.nl/api/v0/klanten/951e4660-3835-4643-8f9c-e523e364a30f" MEDEWERKER = ( - "http://some.medewerkers.nl/api/v1/medewerkers/ffb1a466-fdad-4898-87fa-dae026df38c0" + "http://some.medewerkers.nl/api/v0/medewerkers/ffb1a466-fdad-4898-87fa-dae026df38c0" ) diff --git a/src/openklant/components/contactmomenten/tests/test_notifications_kanaal.py b/src/openklant/components/legacy/contactmomenten/tests/test_notifications_kanaal.py similarity index 96% rename from src/openklant/components/contactmomenten/tests/test_notifications_kanaal.py rename to src/openklant/components/legacy/contactmomenten/tests/test_notifications_kanaal.py index 72638ce4..339548c2 100644 --- a/src/openklant/components/contactmomenten/tests/test_notifications_kanaal.py +++ b/src/openklant/components/legacy/contactmomenten/tests/test_notifications_kanaal.py @@ -9,7 +9,9 @@ from rest_framework.test import APITestCase from zgw_consumers.models import Service -from openklant.components.contactmomenten.models.contactmomenten import ContactMoment +from openklant.components.legacy.contactmomenten.models.contactmomenten import ( + ContactMoment, +) @override_settings(IS_HTTPS=True) diff --git a/src/openklant/components/contactmomenten/tests/test_notifications_send.py b/src/openklant/components/legacy/contactmomenten/tests/test_notifications_send.py similarity index 95% rename from src/openklant/components/contactmomenten/tests/test_notifications_send.py rename to src/openklant/components/legacy/contactmomenten/tests/test_notifications_send.py index b2a2e317..4a7545d0 100644 --- a/src/openklant/components/contactmomenten/tests/test_notifications_send.py +++ b/src/openklant/components/legacy/contactmomenten/tests/test_notifications_send.py @@ -7,8 +7,8 @@ from rest_framework import status from rest_framework.test import APITransactionTestCase -from openklant.components.contactmomenten.models.constants import InitiatiefNemer -from openklant.components.contactmomenten.models.tests.factories import ( +from openklant.components.legacy.contactmomenten.models.constants import InitiatiefNemer +from openklant.components.legacy.contactmomenten.models.tests.factories import ( ContactMomentFactory, ) from openklant.utils.tests.mixins import JWTAuthTransactionMixin diff --git a/src/openklant/components/contactmomenten/tests/utils.py b/src/openklant/components/legacy/contactmomenten/tests/utils.py similarity index 100% rename from src/openklant/components/contactmomenten/tests/utils.py rename to src/openklant/components/legacy/contactmomenten/tests/utils.py diff --git a/src/openklant/components/legacy/klanten/__init__.py b/src/openklant/components/legacy/klanten/__init__.py new file mode 100644 index 00000000..b2f3c2ab --- /dev/null +++ b/src/openklant/components/legacy/klanten/__init__.py @@ -0,0 +1 @@ +default_app_config = "openklant.components.legacy.klanten.apps.KlantenConfig" diff --git a/src/openklant/components/klanten/admin.py b/src/openklant/components/legacy/klanten/admin.py similarity index 100% rename from src/openklant/components/klanten/admin.py rename to src/openklant/components/legacy/klanten/admin.py diff --git a/src/openklant/components/klanten/api/tests/__init__.py b/src/openklant/components/legacy/klanten/api/__init__.py similarity index 100% rename from src/openklant/components/klanten/api/tests/__init__.py rename to src/openklant/components/legacy/klanten/api/__init__.py diff --git a/src/openklant/components/klanten/api/audits.py b/src/openklant/components/legacy/klanten/api/audits.py similarity index 100% rename from src/openklant/components/klanten/api/audits.py rename to src/openklant/components/legacy/klanten/api/audits.py diff --git a/src/openklant/components/klanten/api/auth.py b/src/openklant/components/legacy/klanten/api/auth.py similarity index 100% rename from src/openklant/components/klanten/api/auth.py rename to src/openklant/components/legacy/klanten/api/auth.py diff --git a/src/openklant/components/klanten/api/filters.py b/src/openklant/components/legacy/klanten/api/filters.py similarity index 100% rename from src/openklant/components/klanten/api/filters.py rename to src/openklant/components/legacy/klanten/api/filters.py diff --git a/src/openklant/components/klanten/api/kanalen.py b/src/openklant/components/legacy/klanten/api/kanalen.py similarity index 75% rename from src/openklant/components/klanten/api/kanalen.py rename to src/openklant/components/legacy/klanten/api/kanalen.py index c1118e7c..3220dce2 100644 --- a/src/openklant/components/klanten/api/kanalen.py +++ b/src/openklant/components/legacy/klanten/api/kanalen.py @@ -2,7 +2,7 @@ from notifications_api_common.kanalen import Kanaal -from openklant.components.klanten.models.klanten import Klant +from openklant.components.legacy.klanten.models.klanten import Klant KANAAL_KLANTEN = Kanaal( settings.KLANTEN_NOTIFICATIONS_KANAAL, diff --git a/src/openklant/components/klanten/api/schema.py b/src/openklant/components/legacy/klanten/api/schema.py similarity index 100% rename from src/openklant/components/klanten/api/schema.py rename to src/openklant/components/legacy/klanten/api/schema.py diff --git a/src/openklant/components/klanten/api/scopes.py b/src/openklant/components/legacy/klanten/api/scopes.py similarity index 100% rename from src/openklant/components/klanten/api/scopes.py rename to src/openklant/components/legacy/klanten/api/scopes.py diff --git a/src/openklant/components/klanten/api/serializers.py b/src/openklant/components/legacy/klanten/api/serializers.py similarity index 98% rename from src/openklant/components/klanten/api/serializers.py rename to src/openklant/components/legacy/klanten/api/serializers.py index 1738fa8b..a6431f4f 100644 --- a/src/openklant/components/klanten/api/serializers.py +++ b/src/openklant/components/legacy/klanten/api/serializers.py @@ -8,8 +8,11 @@ from vng_api_common.serializers import add_choice_values_help_text from vng_api_common.validators import IsImmutableValidator, URLValidator -from openklant.components.klanten.models.constants import GeslachtsAanduiding, KlantType -from openklant.components.klanten.models.klanten import ( +from openklant.components.legacy.klanten.models.constants import ( + GeslachtsAanduiding, + KlantType, +) +from openklant.components.legacy.klanten.models.klanten import ( Klant, KlantAdres, NatuurlijkPersoon, diff --git a/src/openklant/components/klanten/migrations/__init__.py b/src/openklant/components/legacy/klanten/api/tests/__init__.py similarity index 100% rename from src/openklant/components/klanten/migrations/__init__.py rename to src/openklant/components/legacy/klanten/api/tests/__init__.py diff --git a/src/openklant/components/klanten/api/tests/test_auth.py b/src/openklant/components/legacy/klanten/api/tests/test_auth.py similarity index 87% rename from src/openklant/components/klanten/api/tests/test_auth.py rename to src/openklant/components/legacy/klanten/api/tests/test_auth.py index 21e5e191..f1f2f3b4 100644 --- a/src/openklant/components/klanten/api/tests/test_auth.py +++ b/src/openklant/components/legacy/klanten/api/tests/test_auth.py @@ -6,10 +6,10 @@ from rest_framework.test import APITestCase from vng_api_common.tests import AuthCheckMixin, JWTAuthMixin, reverse -from openklant.components.klanten.api.scopes import SCOPE_KLANTEN_ALLES_LEZEN -from openklant.components.klanten.models.constants import KlantType -from openklant.components.klanten.models.klanten import Klant -from openklant.components.klanten.models.tests.factories import KlantFactory +from openklant.components.legacy.klanten.api.scopes import SCOPE_KLANTEN_ALLES_LEZEN +from openklant.components.legacy.klanten.models.constants import KlantType +from openklant.components.legacy.klanten.models.klanten import Klant +from openklant.components.legacy.klanten.models.tests.factories import KlantFactory SUBJECT = "http://example.com/subject/1" diff --git a/src/openklant/components/klanten/api/tests/test_klant.py b/src/openklant/components/legacy/klanten/api/tests/test_klant.py similarity index 99% rename from src/openklant/components/klanten/api/tests/test_klant.py rename to src/openklant/components/legacy/klanten/api/tests/test_klant.py index e1814d31..18571c61 100644 --- a/src/openklant/components/klanten/api/tests/test_klant.py +++ b/src/openklant/components/legacy/klanten/api/tests/test_klant.py @@ -3,9 +3,9 @@ from rest_framework.test import APITestCase from vng_api_common.tests import JWTAuthMixin, get_validation_errors, reverse -from openklant.components.klanten.models.constants import KlantType, SoortRechtsvorm -from openklant.components.klanten.models.klanten import Klant -from openklant.components.klanten.models.tests.factories import ( +from openklant.components.legacy.klanten.models.constants import KlantType, SoortRechtsvorm +from openklant.components.legacy.klanten.models.klanten import Klant +from openklant.components.legacy.klanten.models.tests.factories import ( KlantAdresFactory, KlantFactory, NatuurlijkPersoonFactory, diff --git a/src/openklant/components/klanten/api/tests/test_urls.py b/src/openklant/components/legacy/klanten/api/tests/test_urls.py similarity index 100% rename from src/openklant/components/klanten/api/tests/test_urls.py rename to src/openklant/components/legacy/klanten/api/tests/test_urls.py diff --git a/src/openklant/components/klanten/api/tests/views.py b/src/openklant/components/legacy/klanten/api/tests/views.py similarity index 100% rename from src/openklant/components/klanten/api/tests/views.py rename to src/openklant/components/legacy/klanten/api/tests/views.py diff --git a/src/openklant/components/klanten/api/urls.py b/src/openklant/components/legacy/klanten/api/urls.py similarity index 100% rename from src/openklant/components/klanten/api/urls.py rename to src/openklant/components/legacy/klanten/api/urls.py diff --git a/src/openklant/components/klanten/api/utils.py b/src/openklant/components/legacy/klanten/api/utils.py similarity index 100% rename from src/openklant/components/klanten/api/utils.py rename to src/openklant/components/legacy/klanten/api/utils.py diff --git a/src/openklant/components/klanten/api/viewsets.py b/src/openklant/components/legacy/klanten/api/viewsets.py similarity index 97% rename from src/openklant/components/klanten/api/viewsets.py rename to src/openklant/components/legacy/klanten/api/viewsets.py index 51d1bccb..3adf7d69 100644 --- a/src/openklant/components/klanten/api/viewsets.py +++ b/src/openklant/components/legacy/klanten/api/viewsets.py @@ -9,7 +9,7 @@ ) from vng_api_common.permissions import AuthScopesRequired -from openklant.components.klanten.models.klanten import Klant +from openklant.components.legacy.klanten.models.klanten import Klant from .audits import AUDIT_KLANTEN from .filters import KlantFilter diff --git a/src/openklant/components/klanten/apps.py b/src/openklant/components/legacy/klanten/apps.py similarity index 58% rename from src/openklant/components/klanten/apps.py rename to src/openklant/components/legacy/klanten/apps.py index 85df301c..4b755620 100644 --- a/src/openklant/components/klanten/apps.py +++ b/src/openklant/components/legacy/klanten/apps.py @@ -2,4 +2,4 @@ class KlantenConfig(AppConfig): - name = "openklant.components.klanten" + name = "openklant.components.legacy.klanten" diff --git a/src/openklant/components/klanten/migrations/0001_initial.py b/src/openklant/components/legacy/klanten/migrations/0001_initial.py similarity index 100% rename from src/openklant/components/klanten/migrations/0001_initial.py rename to src/openklant/components/legacy/klanten/migrations/0001_initial.py diff --git a/src/openklant/components/klanten/migrations/0002_klant_aanmaakkanaal.py b/src/openklant/components/legacy/klanten/migrations/0002_klant_aanmaakkanaal.py similarity index 100% rename from src/openklant/components/klanten/migrations/0002_klant_aanmaakkanaal.py rename to src/openklant/components/legacy/klanten/migrations/0002_klant_aanmaakkanaal.py diff --git a/src/openklant/components/klanten/migrations/0003_auto_20211217_0958.py b/src/openklant/components/legacy/klanten/migrations/0003_auto_20211217_0958.py similarity index 100% rename from src/openklant/components/klanten/migrations/0003_auto_20211217_0958.py rename to src/openklant/components/legacy/klanten/migrations/0003_auto_20211217_0958.py diff --git a/src/openklant/components/klanten/migrations/0004_klant_geverifieerd.py b/src/openklant/components/legacy/klanten/migrations/0004_klant_geverifieerd.py similarity index 100% rename from src/openklant/components/klanten/migrations/0004_klant_geverifieerd.py rename to src/openklant/components/legacy/klanten/migrations/0004_klant_geverifieerd.py diff --git a/src/openklant/components/klanten/migrations/0005_auto_20230905_1215.py b/src/openklant/components/legacy/klanten/migrations/0005_auto_20230905_1215.py similarity index 100% rename from src/openklant/components/klanten/migrations/0005_auto_20230905_1215.py rename to src/openklant/components/legacy/klanten/migrations/0005_auto_20230905_1215.py diff --git a/src/openklant/components/klanten/models/__init__.py b/src/openklant/components/legacy/klanten/migrations/__init__.py similarity index 100% rename from src/openklant/components/klanten/models/__init__.py rename to src/openklant/components/legacy/klanten/migrations/__init__.py diff --git a/src/openklant/components/klanten/models/migrations/__init__.py b/src/openklant/components/legacy/klanten/models/__init__.py similarity index 100% rename from src/openklant/components/klanten/models/migrations/__init__.py rename to src/openklant/components/legacy/klanten/models/__init__.py diff --git a/src/openklant/components/klanten/models/constants.py b/src/openklant/components/legacy/klanten/models/constants.py similarity index 100% rename from src/openklant/components/klanten/models/constants.py rename to src/openklant/components/legacy/klanten/models/constants.py diff --git a/src/openklant/components/klanten/models/klanten.py b/src/openklant/components/legacy/klanten/models/klanten.py similarity index 100% rename from src/openklant/components/klanten/models/klanten.py rename to src/openklant/components/legacy/klanten/models/klanten.py diff --git a/src/openklant/components/klanten/models/tests/__init__.py b/src/openklant/components/legacy/klanten/models/migrations/__init__.py similarity index 100% rename from src/openklant/components/klanten/models/tests/__init__.py rename to src/openklant/components/legacy/klanten/models/migrations/__init__.py diff --git a/src/openklant/components/klanten/tests/__init__.py b/src/openklant/components/legacy/klanten/models/tests/__init__.py similarity index 100% rename from src/openklant/components/klanten/tests/__init__.py rename to src/openklant/components/legacy/klanten/models/tests/__init__.py diff --git a/src/openklant/components/klanten/models/tests/factories.py b/src/openklant/components/legacy/klanten/models/tests/factories.py similarity index 100% rename from src/openklant/components/klanten/models/tests/factories.py rename to src/openklant/components/legacy/klanten/models/tests/factories.py diff --git a/src/openklant/components/klanten/models/tests/test_audittrail_unique_representation.py b/src/openklant/components/legacy/klanten/models/tests/test_audittrail_unique_representation.py similarity index 100% rename from src/openklant/components/klanten/models/tests/test_audittrail_unique_representation.py rename to src/openklant/components/legacy/klanten/models/tests/test_audittrail_unique_representation.py diff --git a/src/openklant/components/klanten/openapi.yaml b/src/openklant/components/legacy/klanten/openapi.yaml similarity index 99% rename from src/openklant/components/klanten/openapi.yaml rename to src/openklant/components/legacy/klanten/openapi.yaml index 571eeb33..a8478b0c 100644 --- a/src/openklant/components/klanten/openapi.yaml +++ b/src/openklant/components/legacy/klanten/openapi.yaml @@ -764,7 +764,7 @@ paths: type: string format: uuid servers: -- url: /klanten/api/v1 +- url: /klanten/api/v0 components: responses: '400': diff --git a/src/openklant/components/klanten/resources.md b/src/openklant/components/legacy/klanten/resources.md similarity index 100% rename from src/openklant/components/klanten/resources.md rename to src/openklant/components/legacy/klanten/resources.md diff --git a/src/openklant/components/klanten/swagger2.0.json b/src/openklant/components/legacy/klanten/swagger2.0.json similarity index 100% rename from src/openklant/components/klanten/swagger2.0.json rename to src/openklant/components/legacy/klanten/swagger2.0.json diff --git a/src/openklant/components/legacy/klanten/tests/__init__.py b/src/openklant/components/legacy/klanten/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/openklant/components/klanten/tests/test_audittrails.py b/src/openklant/components/legacy/klanten/tests/test_audittrails.py similarity index 100% rename from src/openklant/components/klanten/tests/test_audittrails.py rename to src/openklant/components/legacy/klanten/tests/test_audittrails.py diff --git a/src/openklant/components/klanten/tests/test_notifications_kanaal.py b/src/openklant/components/legacy/klanten/tests/test_notifications_kanaal.py similarity index 100% rename from src/openklant/components/klanten/tests/test_notifications_kanaal.py rename to src/openklant/components/legacy/klanten/tests/test_notifications_kanaal.py diff --git a/src/openklant/components/klanten/tests/test_notifications_send.py b/src/openklant/components/legacy/klanten/tests/test_notifications_send.py similarity index 100% rename from src/openklant/components/klanten/tests/test_notifications_send.py rename to src/openklant/components/legacy/klanten/tests/test_notifications_send.py diff --git a/src/openklant/components/klanten/tests/utils.py b/src/openklant/components/legacy/klanten/tests/utils.py similarity index 100% rename from src/openklant/components/klanten/tests/utils.py rename to src/openklant/components/legacy/klanten/tests/utils.py diff --git a/src/openklant/conf/api.py b/src/openklant/conf/api.py index dc41aa00..1f6af3ec 100644 --- a/src/openklant/conf/api.py +++ b/src/openklant/conf/api.py @@ -11,14 +11,14 @@ REST_FRAMEWORK[ "DEFAULT_PAGINATION_CLASS" ] = "rest_framework.pagination.PageNumberPagination" - +REST_FRAMEWORK["ALLOWED_VERSIONS"] = ("0", "1") SECURITY_DEFINITION_NAME = "JWT-Claims" SWAGGER_SETTINGS = BASE_SWAGGER_SETTINGS.copy() SWAGGER_SETTINGS.update( { - "DEFAULT_INFO": "openklant.components.klanten.api.schema.info", + "DEFAULT_INFO": "openklant.components.legacy.klanten.api.schema.info", "SECURITY_DEFINITIONS": { SECURITY_DEFINITION_NAME: { # OAS 3.0 diff --git a/src/openklant/conf/base.py b/src/openklant/conf/base.py index 1dec9277..f7475642 100644 --- a/src/openklant/conf/base.py +++ b/src/openklant/conf/base.py @@ -135,8 +135,8 @@ "openklant", "openklant.accounts", "openklant.utils", - "openklant.components.klanten", - "openklant.components.contactmomenten", + "openklant.components.legacy.klanten", + "openklant.components.legacy.contactmomenten", ] MIDDLEWARE = [ @@ -362,10 +362,22 @@ # urls for OAS3 specifications SPEC_URL = { "klanten": os.path.join( - BASE_DIR, "src", "openklant", "components", "klanten", "openapi.yaml" + BASE_DIR, + "src", + "openklant", + "components", + "legacy", + "klanten", + "openapi.yaml", ), "contactmomenten": os.path.join( - BASE_DIR, "src", "openklant", "components", "contactmomenten", "openapi.yaml" + BASE_DIR, + "src", + "openklant", + "components", + "legacy", + "contactmomenten", + "openapi.yaml", ), } diff --git a/src/openklant/fixtures/default_admin_index.json b/src/openklant/fixtures/default_admin_index.json index e081866d..dc6e661e 100644 --- a/src/openklant/fixtures/default_admin_index.json +++ b/src/openklant/fixtures/default_admin_index.json @@ -4,72 +4,6 @@ "pk": 1, "fields": { "order": 3, - "name": "Klanten", - "slug": "klanten", - "models": [ - [ - "klanten", - "klant" - ], - [ - "klanten", - "klantadres" - ], - [ - "klanten", - "natuurlijkpersoon" - ], - [ - "klanten", - "nietnatuurlijkpersoon" - ], - [ - "klanten", - "subverblijfbuitenland" - ], - [ - "klanten", - "verblijfsadres" - ], - [ - "klanten", - "vestiging" - ] - ] - } - }, - { - "model": "admin_index.appgroup", - "pk": 2, - "fields": { - "order": 4, - "name": "Contactmomenten", - "slug": "contactmomenten", - "models": [ - [ - "contactmomenten", - "contactmoment" - ], - [ - "contactmomenten", - "klantcontactmoment" - ], - [ - "contactmomenten", - "medewerker" - ], - [ - "contactmomenten", - "objectcontactmoment" - ] - ] - } - }, - { - "model": "admin_index.appgroup", - "pk": 3, - "fields": { - "order": 5, "name": "Configuratie", "slug": "configuratie", "models": [ @@ -98,9 +32,9 @@ }, { "model": "admin_index.appgroup", - "pk": 4, + "pk": 2, "fields": { - "order": 6, + "order": 4, "name": "Notificaties", "slug": "notificaties", "models": [ @@ -117,7 +51,7 @@ }, { "model": "admin_index.appgroup", - "pk": 5, + "pk": 3, "fields": { "order": 1, "name": "Accounts", @@ -140,7 +74,7 @@ }, { "model": "admin_index.appgroup", - "pk": 6, + "pk": 4, "fields": { "order": 2, "name": "API autorisaties", @@ -167,9 +101,9 @@ }, { "model": "admin_index.appgroup", - "pk": 7, + "pk": 5, "fields": { - "order": 7, + "order": 5, "name": "Logging", "slug": "logging", "models": [ @@ -187,5 +121,61 @@ ] ] } + }, + { + "model": "admin_index.appgroup", + "pk": 6, + "fields": { + "order": 6, + "name": "Legacy", + "slug": "legacy", + "models": [ + [ + "klanten", + "klant" + ], + [ + "klanten", + "klantadres" + ], + [ + "klanten", + "natuurlijkpersoon" + ], + [ + "klanten", + "nietnatuurlijkpersoon" + ], + [ + "klanten", + "subverblijfbuitenland" + ], + [ + "klanten", + "verblijfsadres" + ], + [ + "klanten", + "vestiging" + ], + + [ + "contactmomenten", + "contactmoment" + ], + [ + "contactmomenten", + "klantcontactmoment" + ], + [ + "contactmomenten", + "medewerker" + ], + [ + "contactmomenten", + "objectcontactmoment" + ] + ] + } } ] diff --git a/src/openklant/urls.py b/src/openklant/urls.py index 898879b4..0db219da 100644 --- a/src/openklant/urls.py +++ b/src/openklant/urls.py @@ -45,9 +45,10 @@ auth_views.PasswordResetCompleteView.as_view(), name="password_reset_complete", ), - path("klanten/api/", include("openklant.components.klanten.api.urls")), + path("klanten/api/", include("openklant.components.legacy.klanten.api.urls")), path( - "contactmomenten/api/", include("openklant.components.contactmomenten.api.urls") + "contactmomenten/api/", + include("openklant.components.legacy.contactmomenten.api.urls"), ), # Simply show the master template. path("", TemplateView.as_view(template_name="main.html")), diff --git a/src/openklant/utils/middleware.py b/src/openklant/utils/middleware.py index 8f69ca35..4deaedf5 100644 --- a/src/openklant/utils/middleware.py +++ b/src/openklant/utils/middleware.py @@ -11,16 +11,18 @@ def get_version_mapping() -> Dict[str, str]: - apis = ( + legacy_apis = ( "klanten", "contactmomenten", ) + apis = legacy_apis version = settings.REST_FRAMEWORK["DEFAULT_VERSION"] return { - reverse(f"api-root-{api}", kwargs={"version": version}): getattr( - settings, f"{api.upper()}_API_VERSION" - ) + reverse( + f"api-root-{api}", + kwargs={"version": "0" if api in legacy_apis else version}, + ): getattr(settings, f"{api.upper()}_API_VERSION") for api in apis }