Skip to content

Commit

Permalink
Merge pull request #1542 from open-zaak/feature/1537-detail-expand
Browse files Browse the repository at this point in the history
Feature/1537 detail expand
  • Loading branch information
annashamray committed Jan 19, 2024
2 parents 9912d07 + b8a7763 commit 8d790dc
Show file tree
Hide file tree
Showing 14 changed files with 1,602 additions and 291 deletions.
9 changes: 9 additions & 0 deletions src/openzaak/components/documenten/api/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class EnkelvoudigInformatieObjectDetailFilter(FilterSet):
registratie_op = filters.IsoDateTimeFilter(
field_name="begin_registratie", lookup_expr="lte", label="begin_registratie"
)
expand = ExpandFilter(serializer_class=EnkelvoudigInformatieObjectSerializer)


class GebruiksrechtenFilter(FilterSet):
Expand All @@ -62,6 +63,10 @@ class Meta:
}


class GebruiksrechtenDetailFilter(FilterSet):
expand = ExpandFilter(serializer_class=GebruiksrechtenSerializer)


class ObjectFilter(FkOrUrlFieldFilter):
def filter(self, qs, value):
if not value:
Expand Down Expand Up @@ -131,3 +136,7 @@ class Meta:
"informatieobject": ["exact"],
"betrokkene": ["exact"],
}


class VerzendingDetailFilter(FilterSet):
expand = ExpandFilter(serializer_class=VerzendingSerializer)
22 changes: 20 additions & 2 deletions src/openzaak/components/documenten/api/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@
from .filters import (
EnkelvoudigInformatieObjectDetailFilter,
EnkelvoudigInformatieObjectListFilter,
GebruiksrechtenDetailFilter,
GebruiksrechtenFilter,
ObjectInformatieObjectFilter,
VerzendingDetailFilter,
VerzendingFilter,
)
from .kanalen import KANAAL_DOCUMENTEN
Expand Down Expand Up @@ -468,7 +470,6 @@ class GebruiksrechtenViewSet(
.all()
)
serializer_class = GebruiksrechtenSerializer
filterset_class = GebruiksrechtenFilter
lookup_field = "uuid"
notifications_kanaal = KANAAL_DOCUMENTEN
notifications_main_resource_key = "informatieobject"
Expand All @@ -485,6 +486,15 @@ class GebruiksrechtenViewSet(
audit = AUDIT_DRC
audittrail_main_resource_key = "informatieobject"

@property
def filterset_class(self):
"""
To support expand
"""
if self.detail:
return GebruiksrechtenDetailFilter
return GebruiksrechtenFilter


class EnkelvoudigInformatieObjectAuditTrailViewSet(
CMISConnectionPoolMixin, AuditTrailViewSet
Expand Down Expand Up @@ -697,7 +707,6 @@ class VerzendingViewSet(
queryset = Verzending.objects.select_related("informatieobject").order_by("-pk")
serializer_class = VerzendingSerializer
pagination_class = PageNumberPagination
filterset_class = VerzendingFilter
lookup_field = "uuid"
notifications_kanaal = KANAAL_DOCUMENTEN
notifications_main_resource_key = "informatieobject"
Expand All @@ -712,6 +721,15 @@ class VerzendingViewSet(
"partial_update": SCOPE_DOCUMENTEN_BIJWERKEN,
}

@property
def filterset_class(self):
"""
To support expand
"""
if self.detail:
return VerzendingDetailFilter
return VerzendingFilter

def create(self, request, *args, **kwargs):
if settings.CMIS_ENABLED:
raise CMISNotSupportedException()
Expand Down
127 changes: 106 additions & 21 deletions src/openzaak/components/documenten/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,33 @@ paths:
type: string
enum:
- application/json
- name: identificatie
in: query
description: Een binnen een gegeven context ondubbelzinnige referentie naar
het INFORMATIEOBJECT.
required: false
schema:
type: string
- name: bronorganisatie
in: query
description: "Het RSIN van de Niet-natuurlijk persoon zijnde de organisatie\
\ die het informatieobject heeft gecre\xEBerd of heeft ontvangen en als\
\ eerste in een samenwerkingsketen heeft vastgelegd."
required: false
schema:
type: string
- name: expand
in: query
description: 'Sluit de gespecifieerde gerelateerde resources in in het antwoord. '
required: false
schema:
type: array
items:
type: string
enum:
- informatieobjecttype
style: form
explode: false
- name: page
in: query
description: Een pagina binnen de gepagineerde set resultaten.
Expand Down Expand Up @@ -554,6 +581,18 @@ paths:
die qua `begin_registratie` het kortst hiervoor zit wordt opgehaald.
schema:
type: string
- name: expand
in: query
description: 'Sluit de gespecifieerde gerelateerde resources in in het antwoord. '
required: false
schema:
type: array
items:
type: string
enum:
- informatieobjecttype
style: form
explode: false
- name: If-None-Match
in: header
description: "Voer een voorwaardelijk verzoek uit. Deze header moet \xE9\xE9\
Expand Down Expand Up @@ -590,7 +629,19 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/EnkelvoudigInformatieObject'
type: object
allOf:
- $ref: '#/components/schemas/EnkelvoudigInformatieObject'
- type: object
properties:
_expand:
description: Display details of the linked resources requested
in the `expand` parameter
type: object
properties:
informatieobjecttype: https://raw.githubusercontent.com/vng-Realisatie/catalogi-api/1.2.0/src/openapi.yaml#/components/schemas/InformatieObjectType
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
Expand Down Expand Up @@ -1296,6 +1347,19 @@ paths:
summary: Een specifieke GEBRUIKSRECHT opvragen.
description: Een specifieke GEBRUIKSRECHT opvragen.
parameters:
- name: expand
in: query
description: 'Sluit de gespecifieerde gerelateerde resources in in het antwoord. '
required: false
schema:
type: array
items:
type: string
enum:
- informatieobject
- informatieobject.informatieobjecttype
style: form
explode: false
- name: If-None-Match
in: header
description: "Voer een voorwaardelijk verzoek uit. Deze header moet \xE9\xE9\
Expand Down Expand Up @@ -1332,7 +1396,20 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/Gebruiksrechten'
type: object
allOf:
- $ref: '#/components/schemas/Gebruiksrechten'
- type: object
properties:
_expand:
description: Display details of the linked resources requested
in the `expand` parameter
type: object
properties:
informatieobject:
$ref: '#/components/schemas/EnkelvoudigInformatieObject'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
Expand Down Expand Up @@ -1593,22 +1670,6 @@ paths:
operationId: objectinformatieobject_list
summary: Alle OBJECT-INFORMATIEOBJECT relaties opvragen.
description: Deze lijst kan gefilterd wordt met query-string parameters.
parameters:
- name: object
in: query
description: URL-referentie naar het gerelateerde OBJECT (in deze of een andere
API).
required: false
schema:
type: string
format: uri
- name: informatieobject
in: query
description: URL-referentie naar het INFORMATIEOBJECT.
required: false
schema:
type: string
format: uri
responses:
'200':
description: OK
Expand All @@ -1624,8 +1685,6 @@ paths:
type: array
items:
$ref: '#/components/schemas/ObjectInformatieObject'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
Expand Down Expand Up @@ -2167,6 +2226,19 @@ paths:
summary: Een specifieke VERZENDING opvragen.
description: Een specifieke VERZENDING opvragen.
parameters:
- name: expand
in: query
description: 'Sluit de gespecifieerde gerelateerde resources in in het antwoord. '
required: false
schema:
type: array
items:
type: string
enum:
- informatieobject
- informatieobject.informatieobjecttype
style: form
explode: false
- name: If-None-Match
in: header
description: "Voer een voorwaardelijk verzoek uit. Deze header moet \xE9\xE9\
Expand Down Expand Up @@ -2203,7 +2275,20 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/Verzending'
type: object
allOf:
- $ref: '#/components/schemas/Verzending'
- type: object
properties:
_expand:
description: Display details of the linked resources requested
in the `expand` parameter
type: object
properties:
informatieobject:
$ref: '#/components/schemas/EnkelvoudigInformatieObject'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
Expand Down

0 comments on commit 8d790dc

Please sign in to comment.