Skip to content

Commit

Permalink
Production release to version v1.4.2 (#231)
Browse files Browse the repository at this point in the history
* Master into Develop (#226)

*update develop to 1.4.1

* bugfix: lock in EIO_create

* Update README.rst

VNG-Realisatie/gemma-zaken#2301
versienummers concreet gemaakt (ipv 1.2.x etc.)

* Feature/expand to zoek (#230)

* feature : exclusions to zoek and bugfix to exclusions

---------

Co-authored-by: Michiel Verhoef <34736717+michielverhoef@users.noreply.github.com>
  • Loading branch information
MatthijsBekendam and michielverhoef authored Sep 25, 2023
1 parent 2b5dcc9 commit c44c935
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 291 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[bumpversion]
commit = False
tag = False
current_version = 1.4.1
current_version = 1.4.2
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)([-](?P<release>(rc|alpha))+(?P<build>\d+))?
serialize =
{major}.{minor}.{patch}-{release}{build}
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
===========
Wijzigingen
===========
1.4.2 (2023-09-25)
===========

- **Changed:** added expand queryparameter to /zoek
- **Changed:** bestandsdeel serializer to include lock attribute

===========
1.4.1 (2023-08-29)
===========
Expand Down
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Documenten API
==============

:Version: 1.4.0
:Version: 1.4.2
:Source: https://github.com/VNG-Realisatie/documenten-api
:Keywords: zaken, zaakgericht werken, GEMMA, RGBZ, DRC

Expand All @@ -28,16 +28,16 @@ master n.v.t. `ReDoc <https://redocly.github.io/redoc/?url=https:/
`Swagger <https://petstore.swagger.io/?url=https://raw.githubusercontent.com/VNG-Realisatie/documenten-api/1.4.1/src/openapi.yaml>`_
1.4.0 2023-08-22 `ReDoc <https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/VNG-Realisatie/documenten-api/1.4.0/src/openapi.yaml>`_, `Scopes <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.4.0/src/autorisaties.md>`_ `Berichtkenmerken <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.4.0/src/notificaties.md>`_
`Swagger <https://petstore.swagger.io/?url=https://raw.githubusercontent.com/VNG-Realisatie/documenten-api/1.4.0/src/openapi.yaml>`_
1.3.x 2023-03-29 `ReDoc <https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/VNG-Realisatie/documenten-api/stable/1.3.x/src/openapi.yaml>`_, `Scopes <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.3.x/src/autorisaties.md>`_ `Berichtkenmerken <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.3.x/src/notificaties.md>`_
1.3.0 2023-03-29 `ReDoc <https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/VNG-Realisatie/documenten-api/stable/1.3.x/src/openapi.yaml>`_, `Scopes <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.3.x/src/autorisaties.md>`_ `Berichtkenmerken <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.3.x/src/notificaties.md>`_
`Swagger <https://petstore.swagger.io/?url=https://raw.githubusercontent.com/VNG-Realisatie/documenten-api/stable/1.3.x/src/openapi.yaml>`_
(`verschillen <https://github.com/VNG-Realisatie/documenten-api/compare/stable/1.2.x..master>`_)
1.2.x 2022-12-19 `ReDoc <https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/VNG-Realisatie/documenten-api/stable/1.2.x/src/openapi.yaml>`_, `Scopes <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.2.x/src/autorisaties.md>`_ `Berichtkenmerken <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.2.x/src/notificaties.md>`_
1.2.0 2022-12-19 `ReDoc <https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/VNG-Realisatie/documenten-api/stable/1.2.x/src/openapi.yaml>`_, `Scopes <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.2.x/src/autorisaties.md>`_ `Berichtkenmerken <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.2.x/src/notificaties.md>`_
`Swagger <https://petstore.swagger.io/?url=https://raw.githubusercontent.com/VNG-Realisatie/documenten-api/stable/1.2.x/src/openapi.yaml>`_
(`verschillen <https://github.com/VNG-Realisatie/documenten-api/compare/stable/1.1.x..master>`_)
1.1.x 2022-06-30 `ReDoc <https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/VNG-Realisatie/documenten-api/stable/1.1.x/src/openapi.yaml>`_, `Scopes <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.1.x/src/autorisaties.md>`_ `Berichtkenmerken <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.1.x/src/notificaties.md>`_
1.1.0 2022-06-30 `ReDoc <https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/VNG-Realisatie/documenten-api/stable/1.1.x/src/openapi.yaml>`_, `Scopes <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.1.x/src/autorisaties.md>`_ `Berichtkenmerken <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.1.x/src/notificaties.md>`_
`Swagger <https://petstore.swagger.io/?url=https://raw.githubusercontent.com/VNG-Realisatie/documenten-api/stable/1.1.x/src/openapi.yaml>`_
(`verschillen <https://github.com/VNG-Realisatie/documenten-api/compare/1.1.0..stable/1.1.x?diff=split#diff-b9c28fec6c3f3fa5cff870d24601d6ab7027520f3b084cc767aefd258cb8c40a>`_)
1.0.x n.v.t. `ReDoc <https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/VNG-Realisatie/documenten-api/stable/1.0.x/src/openapi.yaml>`_, `Scopes <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.0.x/src/autorisaties.md>`_ `Berichtkenmerken <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.0.x/src/notificaties.md>`_
1.0.0 n.v.t. `ReDoc <https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/VNG-Realisatie/documenten-api/stable/1.0.x/src/openapi.yaml>`_, `Scopes <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.0.x/src/autorisaties.md>`_ `Berichtkenmerken <https://github.com/VNG-Realisatie/documenten-api/blob/stable/1.0.x/src/notificaties.md>`_
`Swagger <https://petstore.swagger.io/?url=https://raw.githubusercontent.com/VNG-Realisatie/documenten-api/stable/1.0.x/src/openapi.yaml>`_
(`verschillen <https://github.com/VNG-Realisatie/documenten-api/compare/1.0.1..stable/1.0.x?diff=split#diff-b9c28fec6c3f3fa5cff870d24601d6ab7027520f3b084cc767aefd258cb8c40a>`_)
1.0.1 2019-12-16 `ReDoc <https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/VNG-Realisatie/documenten-api/1.0.1/src/openapi.yaml>`_, `Scopes <https://github.com/VNG-Realisatie/documenten-api/blob/1.0.1/src/autorisaties.md>`_ `Berichtkenmerken <https://github.com/VNG-Realisatie/documenten-api/blob/1.0.1/src/notificaties.md>`_
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "drc",
"version": "1.4.1",
"version": "1.4.2",
"description": "drc referentie implementatie API",
"main": "src/index.js",
"directories": {
Expand Down
2 changes: 1 addition & 1 deletion src/drc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import re
from collections import namedtuple

__version__ = "1.4.1"
__version__ = "1.4.2"
__author__ = "VNG Realisatie"
__homepage__ = "https://github.com/VNG-Realisatie/documenten-api"
__docformat__ = "restructuredtext"
Expand Down
5 changes: 4 additions & 1 deletion src/drc/api/exclusions.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def build_expand_schema(
):
"""Build the expand schema for the response. First, the fields to expand are split on the "." character. Then, the first part of the split is used to get the urls from the result. The urls are then used to get the corresponding data from the external api or from the local database. The data is then gathered/collected inside a list consisted of namedtuples. When all data is collected, it calls the _build_json method which builds the json response."""
expansion = {"_expand": {}}
self.expanded_fields_all = []

for exp_field in fields_to_expand:
loop_id = str(uuid.uuid4())
Expand Down Expand Up @@ -509,9 +510,11 @@ def remove_key(self, data, target_key):

def inclusions(self, response):
expand_filter = self.request.query_params.get("expand", "")
if self.action == "_zoek":
expand_filter = self.get_search_input().get("expand", "")
if expand_filter:
fields_to_expand = expand_filter.split(",")
if self.action == "list":
if self.action == "list" or self.action == "_zoek":
for response_data in (
response.data
if isinstance(response.data, list)
Expand Down
8 changes: 8 additions & 0 deletions src/drc/api/serializers/enkelvoudig_informatieobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,14 @@ class EIOZoekSerializer(serializers.Serializer):
child=serializers.UUIDField(),
help_text=_("Array of unieke resource identifiers (UUID4)"),
)
expand = serializers.CharField(
help_text=_(
"Examples: \n"
"`expand=zaaktype, status, status.statustype, hoofdzaak.status.statustype, hoofdzaak.deelzaken.status.statustype`\n"
"Haal details van gelinkte resources direct op. Als je meerdere resources tegelijk wilt ophalen kun je deze scheiden met een komma. Voor het ophalen van resources die een laag dieper genest zijn wordt de punt-notatie gebruikt.",
),
required=False,
)


class SchemaEIOSerializer(EnkelvoudigInformatieObjectSerializer):
Expand Down
2 changes: 1 addition & 1 deletion src/drc/api/tests/test_dso_api_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_api_19_documentation_version_yaml(self):
@override_settings(ROOT_URLCONF="drc.api.tests.test_urls")
def test_api_24_version_header(self):
response = self.client.get("/test-view")
self.assertEqual(response["API-version"], "1.4.1")
self.assertEqual(response["API-version"], "1.4.2")


class DSOApi50Tests(APITestCase):
Expand Down
13 changes: 13 additions & 0 deletions src/drc/api/tests/test_enkelvoudiginformatieobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,19 @@ def test_zoek_uuid_in(self):
self.assertEqual(data[0]["url"], f"http://testserver{reverse(eio1)}")
self.assertEqual(data[1]["url"], f"http://testserver{reverse(eio2)}")

def test_zoek_expand(self):
eio1, eio2, eio3 = EnkelvoudigInformatieObjectFactory.create_batch(3)
url = get_operation_url("enkelvoudiginformatieobject__zoek")
data = {"uuid__in": [eio1.uuid, eio2.uuid], "expand": "url"}
response = self.client.post(url, data)

self.assertEqual(response.status_code, status.HTTP_200_OK)

data = response.json()["results"]
data = sorted(data, key=lambda eio: eio["identificatie"])
self.assertEqual(len(data), 2)
self.assertTrue(bool(data[0]["_expand"]))

def test_zoek_without_params(self):
url = get_operation_url("enkelvoudiginformatieobject__zoek")
response = self.client.post(url, {})
Expand Down
14 changes: 13 additions & 1 deletion src/drc/api/views/enkelvoudig_informatieobject.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.db import transaction
from django.db import models, transaction
from django.utils.translation import gettext as _

from drf_spectacular.types import OpenApiTypes
Expand Down Expand Up @@ -214,12 +214,18 @@ def _zoek(self, request, *args, **kwargs):
search_input = self.get_search_input()
queryset = self.filter_queryset(self.get_queryset())
for name, value in search_input.items():
if name == "expand":
continue
queryset = queryset.filter(**{name: value})

return self.get_search_output(queryset)

_zoek.is_search_action = True

def get_search_output(self, queryset: models.QuerySet):
response = super().get_search_output(queryset)
return self.inclusions(response)

@transaction.atomic
def perform_destroy(self, instance):
if instance.canonical.objectinformatieobject_set.exists():
Expand Down Expand Up @@ -265,6 +271,12 @@ def get_serializer_class(self, *args, **kwargs):
def retrieve(self, request, *args, **kwargs):
return super().retrieve(request, *args, **kwargs)

@extend_schema(
responses=SchemaEIOSerializer,
)
def create(self, request, *args, **kwargs):
return super().create(request, *args, **kwargs)

@extend_schema(
# see https://swagger.io/docs/specification/2-0/describing-responses/ and
# https://swagger.io/docs/specification/2-0/mime-types/
Expand Down
3 changes: 2 additions & 1 deletion src/drc/conf/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

from vng_api_common.conf.api import * # noqa - imports white-listed

API_VERSION = "1.4.1"
API_VERSION = "1.4.2"


REST_FRAMEWORK = BASE_REST_FRAMEWORK.copy()
REST_FRAMEWORK["PAGE_SIZE"] = 100
Expand Down
Loading

0 comments on commit c44c935

Please sign in to comment.