diff --git a/src/openforms/registrations/contrib/zgw_apis/migrations/0001_initial_to_v280.py b/src/openforms/registrations/contrib/zgw_apis/migrations/0001_initial_to_v280.py new file mode 100644 index 0000000000..b1c7a813a5 --- /dev/null +++ b/src/openforms/registrations/contrib/zgw_apis/migrations/0001_initial_to_v280.py @@ -0,0 +1,232 @@ +# Generated by Django 4.2.17 on 2024-12-27 16:11 + +import django.core.validators +import django.db.models.deletion +from django.db import migrations, models + +import openforms.registrations.contrib.zgw_apis.models +import openforms.template.validators +import openforms.utils.validators + + +class Migration(migrations.Migration): + + replaces = [ + ("zgw_apis", "0001_initial"), + ("zgw_apis", "0002_auto_20210514_1129"), + ("zgw_apis", "0003_auto_20210521_1352"), + ("zgw_apis", "0004_auto_20210902_2120"), + ("zgw_apis", "0005_auto_20230221_1552"), + ("zgw_apis", "0006_zgwapigroupconfig"), + ("zgw_apis", "0007_move_singleton_data"), + ("zgw_apis", "0008_auto_20230608_1443"), + ("zgw_apis", "0009_add_default"), + ("zgw_apis", "0010_zgwapigroupconfig_content_json"), + ("zgw_apis", "0011_move_zgw_api_group_defaults_to_form"), + ("zgw_apis", "0012_remove_zgwapigroupconfig_informatieobjecttype_and_more"), + ("zgw_apis", "0013_set_zgw_api_group"), + ("zgw_apis", "0014_zgwapigroupconfig_catalogue_domain_and_more"), + ] + + dependencies = [ + ("zgw_consumers", "0019_alter_service_uuid"), + ("forms", "0097_v267_to_v270"), + ] + + operations = [ + migrations.CreateModel( + name="ZGWApiGroupConfig", + fields=[ + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "name", + models.CharField( + help_text="A recognisable name for this set of ZGW APIs.", + max_length=255, + verbose_name="name", + ), + ), + ( + "organisatie_rsin", + models.CharField( + blank=True, + help_text="Default RSIN of organization, which creates the ZAAK", + max_length=9, + validators=[openforms.utils.validators.RSINValidator()], + verbose_name="organisation RSIN", + ), + ), + ( + "zaak_vertrouwelijkheidaanduiding", + models.CharField( + blank=True, + choices=[ + ("openbaar", "Openbaar"), + ("beperkt_openbaar", "Beperkt openbaar"), + ("intern", "Intern"), + ("zaakvertrouwelijk", "Zaakvertrouwelijk"), + ("vertrouwelijk", "Vertrouwelijk"), + ("confidentieel", "Confidentieel"), + ("geheim", "Geheim"), + ("zeer_geheim", "Zeer geheim"), + ], + help_text="Indication of the level to which extend the ZAAK is meant to be public. Can be overridden in the Registration tab of a given form.", + max_length=24, + verbose_name="vertrouwelijkheidaanduiding zaak", + ), + ), + ( + "doc_vertrouwelijkheidaanduiding", + models.CharField( + blank=True, + choices=[ + ("openbaar", "Openbaar"), + ("beperkt_openbaar", "Beperkt openbaar"), + ("intern", "Intern"), + ("zaakvertrouwelijk", "Zaakvertrouwelijk"), + ("vertrouwelijk", "Vertrouwelijk"), + ("confidentieel", "Confidentieel"), + ("geheim", "Geheim"), + ("zeer_geheim", "Zeer geheim"), + ], + help_text="Indication of the level to which extend the document associated with the ZAAK is meant to be public. Can be overridden in the file upload component of a given form.", + max_length=24, + verbose_name="vertrouwelijkheidaanduiding document", + ), + ), + ( + "auteur", + models.CharField( + default="Aanvrager", max_length=200, verbose_name="auteur" + ), + ), + ( + "drc_service", + models.ForeignKey( + limit_choices_to={"api_type": "drc"}, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="zgwset_drc_config", + to="zgw_consumers.service", + verbose_name="Documenten API", + ), + ), + ( + "zrc_service", + models.ForeignKey( + limit_choices_to={"api_type": "zrc"}, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="zgwset_zrc_config", + to="zgw_consumers.service", + verbose_name="Zaken API", + ), + ), + ( + "ztc_service", + models.ForeignKey( + limit_choices_to={"api_type": "ztc"}, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="zgwset_ztc_config", + to="zgw_consumers.service", + verbose_name="Catalogi API", + ), + ), + ( + "content_json", + models.TextField( + blank=True, + default=openforms.registrations.contrib.zgw_apis.models.get_content_text, + help_text="This template is evaluated with the submission data and the resulting JSON is sent to the objects API.", + validators=[ + openforms.template.validators.DjangoTemplateValidator( + backend="openforms.template.openforms_backend" + ) + ], + verbose_name="objects API - JSON content template", + ), + ), + ( + "catalogue_domain", + models.CharField( + blank=True, + help_text="The 'domein' attribute for the Catalogus resource in the Catalogi API.", + max_length=5, + validators=[ + django.core.validators.RegexValidator( + "^[A-Z]*$", + code="invalid", + message="Value must be all uppercase letters.", + ) + ], + verbose_name="catalogus domain", + ), + ), + ( + "catalogue_rsin", + models.CharField( + blank=True, + help_text="The 'rsin' attribute for the Catalogus resource in the Catalogi API.", + max_length=9, + validators=[openforms.utils.validators.RSINValidator()], + verbose_name="catalogus RSIN", + ), + ), + ], + options={ + "verbose_name": "ZGW API set", + "verbose_name_plural": "ZGW API sets", + }, + ), + migrations.CreateModel( + name="ZgwConfig", + fields=[ + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "default_zgw_api_group", + models.ForeignKey( + help_text="Which set of ZGW APIs should be used as default.", + null=True, + on_delete=django.db.models.deletion.PROTECT, + to="zgw_apis.zgwapigroupconfig", + verbose_name="default ZGW API set.", + ), + ), + ], + options={ + "verbose_name": "ZGW API's configuration", + }, + ), + migrations.AddConstraint( + model_name="zgwapigroupconfig", + constraint=models.CheckConstraint( + check=models.Q( + models.Q(("catalogue_domain", ""), ("catalogue_rsin", "")), + models.Q( + models.Q(("catalogue_domain", ""), _negated=True), + models.Q(("catalogue_rsin", ""), _negated=True), + ), + _connector="OR", + ), + name="registrations_zgw_apis_catalogue_composite_key", + violation_error_message="You must specify both domain and RSIN to uniquely identify a catalogue.", + ), + ), + ]