Skip to content

Commit

Permalink
Fixed issue with api-models dataclasses for eSuite
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart van der Schoor committed Feb 9, 2023
1 parent a558919 commit 6a8f8f7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/open_inwoner/components/templatetags/file_tags.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pathlib

from django import template
from django.utils.translation import gettext_lazy as _

from filer.models.filemodels import File
from zgw_consumers.api_models.zaken import ZaakInformatieObject

from open_inwoner.openzaak.api_models import ZaakInformatieObject

register = template.Library()

Expand Down
40 changes: 35 additions & 5 deletions src/open_inwoner/openzaak/api_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
from datetime import date, datetime
from typing import Dict, Optional, Union

from dateutil import relativedelta
from zgw_consumers.api_models.base import Model, ZGWModel
from zgw_consumers.api_models.catalogi import (
InformatieObjectType,
ResultaatType,
RolType,
)
from zgw_consumers.api_models.constants import RolOmschrijving, RolTypes

"""
Expand Down Expand Up @@ -81,6 +77,17 @@ class ZaakInformatieObject(ZGWModel):
registratiedatum: datetime


@dataclass
class InformatieObjectType(ZGWModel):
url: str # bug: not required according to OAS
catalogus: str
omschrijving: str
vertrouwelijkheidaanduiding: str
begin_geldigheid: Optional[date] = None
einde_geldigheid: Optional[date] = None
concept: bool = False


@dataclass
class InformatieObject(ZGWModel):
url: str
Expand Down Expand Up @@ -110,6 +117,14 @@ class InformatieObject(ZGWModel):
integriteit: Optional[dict] = None # {'algoritme': '', 'waarde': '', 'datum': None}


@dataclass
class RolType(ZGWModel):
url: str # bug: not required according to OAS
zaaktype: str
omschrijving: str
omschrijving_generiek: str = ""


@dataclass
class Rol(ZGWModel):
url: str
Expand All @@ -131,6 +146,21 @@ def get_omschrijving_generiek_display(self):
return RolOmschrijving.values[self.omschrijving_generiek]


@dataclass
class ResultaatType(ZGWModel):
url: str # bug: not required according to OAS
zaaktype: str
omschrijving: str
resultaattypeomschrijving: str
selectielijstklasse: str

omschrijving_generiek: str = ""
toelichting: str = ""
archiefnominatie: str = ""
archiefactietermijn: Optional[relativedelta] = None
brondatum_archiefprocedure: Optional[dict] = None


@dataclass
class Resultaat(ZGWModel):
url: str
Expand Down
8 changes: 2 additions & 6 deletions src/open_inwoner/openzaak/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@
from requests import RequestException
from zds_client import ClientError
from zgw_consumers.api_models.base import factory
from zgw_consumers.api_models.catalogi import (
Catalogus,
InformatieObjectType,
ResultaatType,
)
from zgw_consumers.api_models.catalogi import Catalogus
from zgw_consumers.service import get_paginated_results

from .api_models import StatusType, ZaakType
from .api_models import InformatieObjectType, ResultaatType, StatusType, ZaakType
from .clients import build_client
from .utils import cache as cache_result, get_retrieve_resource_by_uuid_url

Expand Down

0 comments on commit 6a8f8f7

Please sign in to comment.