diff --git a/src/open_inwoner/openzaak/api_models.py b/src/open_inwoner/openzaak/api_models.py index 1bc572e510..f1d9784bc8 100644 --- a/src/open_inwoner/openzaak/api_models.py +++ b/src/open_inwoner/openzaak/api_models.py @@ -3,6 +3,7 @@ from typing import Optional from zgw_consumers.api_models.base import ZGWModel +from zgw_consumers.api_models.constants import RolOmschrijving, RolTypes """ Modified ZGWModel's to work with both OpenZaak and e-Suite implementations, @@ -99,3 +100,24 @@ class InformatieObject(ZGWModel): informatieobjecttype: str locked: bool # bestandsdelen: List[str] + + +@dataclass +class Rol(ZGWModel): + url: str + zaak: str + betrokkene_type: str + roltype: str + omschrijving: str + omschrijving_generiek: str + roltoelichting: str + indicatie_machtiging: Optional[str] = "" + registratiedatum: Optional[datetime] = None + betrokkene: Optional[str] = "" + betrokkene_identificatie: Optional[dict] = "" + + def get_betrokkene_type_display(self): + return RolTypes.values[self.betrokkene_type] + + def get_omschrijving_generiek_display(self): + return RolOmschrijving.values[self.omschrijving_generiek] diff --git a/src/open_inwoner/openzaak/cases.py b/src/open_inwoner/openzaak/cases.py index 5031f5cd4c..b74a82dfca 100644 --- a/src/open_inwoner/openzaak/cases.py +++ b/src/open_inwoner/openzaak/cases.py @@ -5,10 +5,10 @@ from zds_client import ClientError from zgw_consumers.api_models.base import factory from zgw_consumers.api_models.constants import RolOmschrijving, RolTypes -from zgw_consumers.api_models.zaken import Resultaat, Rol, Status, Zaak +from zgw_consumers.api_models.zaken import Resultaat, Status from zgw_consumers.service import get_paginated_results -from .api_models import Zaak, ZaakInformatieObject +from .api_models import Rol, Zaak, ZaakInformatieObject from .clients import build_client from .models import OpenZaakConfig from .utils import cache as cache_result diff --git a/src/open_inwoner/openzaak/tests/test_utils.py b/src/open_inwoner/openzaak/tests/test_utils.py index 8048ca8f6c..062bede527 100644 --- a/src/open_inwoner/openzaak/tests/test_utils.py +++ b/src/open_inwoner/openzaak/tests/test_utils.py @@ -2,10 +2,9 @@ from zgw_consumers.api_models.base import factory from zgw_consumers.api_models.constants import RolTypes, VertrouwelijkheidsAanduidingen -from zgw_consumers.api_models.zaken import Rol from zgw_consumers.test import generate_oas_component -from open_inwoner.openzaak.api_models import InformatieObject +from open_inwoner.openzaak.api_models import InformatieObject, Rol from open_inwoner.openzaak.utils import get_role_name_display, is_info_object_visible diff --git a/src/open_inwoner/openzaak/utils.py b/src/open_inwoner/openzaak/utils.py index 80f4ec9bbf..39ea6a205b 100644 --- a/src/open_inwoner/openzaak/utils.py +++ b/src/open_inwoner/openzaak/utils.py @@ -5,9 +5,8 @@ from django.core.cache import caches from zgw_consumers.api_models.constants import RolTypes, VertrouwelijkheidsAanduidingen -from zgw_consumers.api_models.zaken import Rol -from open_inwoner.openzaak.api_models import InformatieObject, Zaak +from open_inwoner.openzaak.api_models import InformatieObject, Rol, Zaak from .models import OpenZaakConfig