Skip to content

Commit

Permalink
Merge pull request #355 from maykinmedia/hotfix/esuite-rol-apimodel
Browse files Browse the repository at this point in the history
Hotfix to make changes to ZWG Rol API model for e-Suite missing fields
  • Loading branch information
alextreme authored Dec 1, 2022
2 parents 98b592e + c02fc10 commit 243b4c7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
22 changes: 22 additions & 0 deletions src/open_inwoner/openzaak/api_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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]
4 changes: 2 additions & 2 deletions src/open_inwoner/openzaak/cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/open_inwoner/openzaak/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
3 changes: 1 addition & 2 deletions src/open_inwoner/openzaak/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 243b4c7

Please sign in to comment.