Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1890 ✨ Expand parameter for Zaken endpoint #207

Merged
merged 4 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions src/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3085,6 +3085,18 @@ paths:
- -publicatiedatum
- archiefactiedatum
- -archiefactiedatum
- name: expand
in: query
description: Haal details van inline resources direct op.
schema:
type: string
enum:
- status
- resultaat
- eigenschappen
- rollen
- zaakobjecten
- zaakinformatieobjecten
- name: page
in: query
description: Een pagina binnen de gepagineerde set resultaten.
Expand Down Expand Up @@ -3300,6 +3312,18 @@ paths:
required: false
schema:
type: integer
- name: expand
in: query
description: Haal details van inline resources direct op.
schema:
type: string
enum:
- status
- resultaat
- eigenschappen
- rollen
- zaakobjecten
- zaakinformatieobjecten
- name: Accept-Crs
in: header
description: Het gewenste 'Coordinate Reference System' (CRS) van de geometrie
Expand Down Expand Up @@ -3397,6 +3421,18 @@ paths:
summary: Een specifieke ZAAK opvragen.
description: Een specifieke ZAAK opvragen.
parameters:
- name: expand
in: query
description: Haal details van inline resources direct op.
schema:
type: string
enum:
- status
- resultaat
- eigenschappen
- rollen
- zaakobjecten
- zaakinformatieobjecten
- name: Accept-Crs
in: header
description: Het gewenste 'Coordinate Reference System' (CRS) van de geometrie
Expand Down Expand Up @@ -7247,13 +7283,34 @@ components:
format: uri
readOnly: true
uniqueItems: true
rollen:
type: array
items:
type: string
format: uri
readOnly: true
uniqueItems: true
status:
title: Status
description: Indien geen status bekend is, dan is de waarde 'null'
type: string
format: uri
readOnly: true
nullable: true
zaakinformatieobjecten:
type: array
items:
type: string
format: uri
readOnly: true
uniqueItems: true
zaakobjecten:
type: array
items:
type: string
format: uri
readOnly: true
uniqueItems: true
kenmerken:
description: Lijst van kenmerken. Merk op dat refereren naar gerelateerde
objecten beter kan via `ZaakObject`.
Expand Down Expand Up @@ -7600,6 +7657,33 @@ components:
- -publicatiedatum
- archiefactiedatum
- -archiefactiedatum
expand:
title: Expand
description: 'Haal details van inline resources direct op.


Uitleg bij mogelijke waarden:


* `status` - status

* `resultaat` - resultaat

* `eigenschappen` - eigenschappen

* `rollen` - rollen

* `zaakobjecten` - zaakobjecten

* `zaakinformatieobjecten` - zaakinformatieobjecten'
type: string
enum:
- status
- resultaat
- eigenschappen
- rollen
- zaakobjecten
- zaakinformatieobjecten
Wijzigingen:
type: object
properties:
Expand Down
3 changes: 3 additions & 0 deletions src/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ Uitleg bij mogelijke waarden:
| deelzaken | URL-referenties naar deel ZAAKen. | array | nee | ~~C~~​R​~~U~~​~~D~~ |
| relevanteAndereZaken | Een lijst van relevante andere zaken. | array | nee | C​R​U​D |
| eigenschappen | | array | nee | ~~C~~​R​~~U~~​~~D~~ |
| rollen | | array | nee | ~~C~~​R​~~U~~​~~D~~ |
| status | Indien geen status bekend is, dan is de waarde 'null' | string | nee | ~~C~~​R​~~U~~​~~D~~ |
| zaakinformatieobjecten | | array | nee | ~~C~~​R​~~U~~​~~D~~ |
| zaakobjecten | | array | nee | ~~C~~​R​~~U~~​~~D~~ |
| kenmerken | Lijst van kenmerken. Merk op dat refereren naar gerelateerde objecten beter kan via `ZaakObject`. | array | nee | C​R​U​D |
| archiefnominatie | Aanduiding of het zaakdossier blijvend bewaard of na een bepaalde termijn vernietigd moet worden.

Expand Down
82 changes: 82 additions & 0 deletions src/swagger2.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -3898,6 +3898,20 @@
"-archiefactiedatum"
]
},
{
"name": "expand",
"in": "query",
"description": "Haal details van inline resources direct op.",
"type": "string",
"enum": [
"status",
"resultaat",
"eigenschappen",
"rollen",
"zaakobjecten",
"zaakinformatieobjecten"
]
},
{
"name": "page",
"in": "query",
Expand Down Expand Up @@ -4170,6 +4184,20 @@
"required": false,
"type": "integer"
},
{
"name": "expand",
"in": "query",
"description": "Haal details van inline resources direct op.",
"type": "string",
"enum": [
"status",
"resultaat",
"eigenschappen",
"rollen",
"zaakobjecten",
"zaakinformatieobjecten"
]
},
{
"name": "Accept-Crs",
"in": "header",
Expand Down Expand Up @@ -4288,6 +4316,20 @@
"summary": "Een specifieke ZAAK opvragen.",
"description": "Een specifieke ZAAK opvragen.",
"parameters": [
{
"name": "expand",
"in": "query",
"description": "Haal details van inline resources direct op.",
"type": "string",
"enum": [
"status",
"resultaat",
"eigenschappen",
"rollen",
"zaakobjecten",
"zaakinformatieobjecten"
]
},
{
"name": "Accept-Crs",
"in": "header",
Expand Down Expand Up @@ -8734,6 +8776,15 @@
"readOnly": true,
"uniqueItems": true
},
"rollen": {
"type": "array",
"items": {
"type": "string",
"format": "uri"
},
"readOnly": true,
"uniqueItems": true
},
"status": {
"title": "Status",
"description": "Indien geen status bekend is, dan is de waarde 'null'",
Expand All @@ -8742,6 +8793,24 @@
"readOnly": true,
"x-nullable": true
},
"zaakinformatieobjecten": {
"type": "array",
"items": {
"type": "string",
"format": "uri"
},
"readOnly": true,
"uniqueItems": true
},
"zaakobjecten": {
"type": "array",
"items": {
"type": "string",
"format": "uri"
},
"readOnly": true,
"uniqueItems": true
},
"kenmerken": {
"description": "Lijst van kenmerken. Merk op dat refereren naar gerelateerde objecten beter kan via `ZaakObject`.",
"type": "array",
Expand Down Expand Up @@ -8993,6 +9062,19 @@
"archiefactiedatum",
"-archiefactiedatum"
]
},
"expand": {
"title": "Expand",
"description": "Haal details van inline resources direct op.\n\nUitleg bij mogelijke waarden:\n\n* `status` - status\n* `resultaat` - resultaat\n* `eigenschappen` - eigenschappen\n* `rollen` - rollen\n* `zaakobjecten` - zaakobjecten\n* `zaakinformatieobjecten` - zaakinformatieobjecten",
"type": "string",
"enum": [
"status",
"resultaat",
"eigenschappen",
"rollen",
"zaakobjecten",
"zaakinformatieobjecten"
]
}
}
},
Expand Down
20 changes: 20 additions & 0 deletions src/zrc/api/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
ZaakVerzoek,
)

from .serializers import ZaakSerializer


class MaximaleVertrouwelijkheidaanduidingFilter(filters.ChoiceFilter):
def __init__(self, *args, **kwargs):
Expand All @@ -37,6 +39,20 @@ def filter(self, qs, value):
return super().filter(qs, numeric_value)


# TODO move to vng-api-common
class ExpandFilter(filters.ChoiceFilter):
def __init__(self, *args, **kwargs):
serializer_class = kwargs.pop("serializer_class")
kwargs.setdefault(
"choices", [(x, x) for x in serializer_class.Meta.expandable_fields]
)

super().__init__(*args, **kwargs)

def filter(self, qs, value):
return qs


class ZaakFilter(FilterSet):
maximale_vertrouwelijkheidaanduiding = MaximaleVertrouwelijkheidaanduidingFilter(
field_name="vertrouwelijkheidaanduiding",
Expand Down Expand Up @@ -77,6 +93,10 @@ class ZaakFilter(FilterSet):
),
help_text="Het veld waarop de resultaten geordend worden.",
)
expand = ExpandFilter(
serializer_class=ZaakSerializer,
help_text="Haal details van inline resources direct op.",
)

class Meta:
model = Zaak
Expand Down
Loading